Opened at 2009-09-09T16:13:44Z
Closed at 2009-12-01T00:42:59Z
#801 closed task (fixed)
Investigate Py_ssize_t behavior in wrappers for CPython < 2.5
Reported by: | nejucomo | Owned by: | nejucomo |
---|---|---|---|
Priority: | minor | Milestone: | 1.6.0 |
Component: | code | Version: | 1.5.0 |
Keywords: | wrapper cast | Cc: | |
Launchpad Bug: |
Description
Py_ssize_t was introduced in CPython 2.5 in Pep 353 [1]. Older Python wrappers treated sizes inconsistently.
This ticket is closed when:
- An explanation is given of how wrapper code that relies on Py_ssize_t compiles in pre 2.5 environments (start with [2]).
- A unit test is written which determines if code relying on Py_ssize_t behaves correctly on < 2.5 and >= 2.5 platforms.
- If the unit test shows no distinction between the two version cases, an explanation of why there's no failure in all cases. Otherwise, jump to step b and devise a new unit test.
- A ticket is opened for each created failing unit test.
[1] http://www.python.org/dev/peps/pep-0353/ [2] http://www.google.com/search?q=Py_ssize_t
Change History (6)
comment:1 Changed at 2009-09-11T03:17:32Z by zooko
comment:2 Changed at 2009-09-11T03:17:56Z by zooko
P.S. Step (e), release a new version of pycryptopp as soon as you've signed off on this ticket...
comment:3 Changed at 2009-09-11T21:12:58Z by zooko
Everyone please see http://allmydata.org/trac/pycryptopp/ticket/19#comment:8 and post your results.
comment:4 Changed at 2009-10-02T19:08:00Z by zooko
- Owner changed from nobody to nejucomo
Nej: good enough? Then please close this ticket.
comment:5 Changed at 2009-12-01T00:21:09Z by davidsarah
- Component changed from unknown to code
- Milestone changed from undecided to 1.6.0
comment:6 Changed at 2009-12-01T00:42:59Z by zooko
- Resolution set to fixed
- Status changed from new to closed
nejucomo closed the sister ticket http://allmydata.org/trac/pycryptopp/ticket/19 so I'm closing this one.
This creates a Py_ssize_t type, which is actually int, if the Python version is < 2.5.0. The only thing to be safe is to pass objects of type Py_ssize_t (instead of int or size_t as I apparently did) to PyArg_ParseTupleAndKeywords() as a "#" argument. Your patch does that.
Good? :-)