This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ked-tao
Recipients
Date 2007-02-16.16:46:49
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Hi,

I am submitting two patches (both against the 2.5 release sources). One
contains a set of changes which have subsequently been compiled by me and
used to run lib/python/test/regrtest.py. If the format of the changes
themselves is acceptable, then I believe this patch can be applied relatively
confidently. I haven't paid too much attention to conditional compilation in
those files, but there appears to be little in the areas I've touched.

The second contains a set of changes to source files that are not being used
at present on my system. Therefore, they _may_ not compile. I have visually
checked that all functions whose signature I have changed are not called
directly (across all source files) with the old signature and have also checked
header file prototypes. However, that doesn't mean I didn't miss something, so
this patch should be applied with a little more care.

The nature of the fixes themselves are discussed below.

-----------------------------------
==== Fixes to common problems across several files:

* Failure to declare second (always NULL) parameter on functions registered as
  METH_NOARGS methods.

  - These all now have a second parameter declared as "PyObject *NOARGS_NULL".
  - I have also changed ones that already declared the parameter as
    "void *ignored" etc, as I think the name makes it clear why it's there.
    If the upper-case name is bad style, feel free to change it to something
    else - as they are all now consistent, that should be a trivial process
    to change in the patch file before applying it.

* PyGetSetDef 'getter' and 'setter' functions not declaring the final 'closure'
  parameter.

  - These all now have a final parameter declared as "void *closure".
  - I have also changed ones that already declared the parameter as
    "void *context" or "void *ignored" etc, for consistency.

* The tp_clear type slot is defined as type 'inquiry' but the return value is
  ignored and in some instances, not returned at all. This is related to the
  following thread:

  http://mail.python.org/pipermail/python-dev/2003-April/034433.html

  frameobject.c and traceback.c were either missed when those changes were
  made, or the problems were re-introduced since.

  - I have changed the functions in those files to return zero.

==== Miscellaneous individual fixes:

* Objects/fileobject.c:file_self() is registered both in the "tp_iter" slot
  and as a METH_NOARGS function. The "tp_iter" slot function is
  called with one parameter (the object) and the METH_NOARGS function is called
  with two parameters (the object, a NULL pointer).

  - Wrapper function file_self_noargs() created which accepts the additional
    "PyObject *NOARGS_NULL" parameter and just calls the file_self() function.
  - All other occurences of tp_iter visually checked and appear to be OK.

* The datetimemodule.c problem with time_isoformat() being registered as
  METH_KEYWORDS instead of METH_NOARGS is also fixed here, though I believe
  that has already been dealt with.

-----------------------------------

All in all, that was a pretty tedious process! Hopefully these changes can 
mostly make it in so I don't have to do it all over again one day ;)

Regards, Kev.

File Added: untested.diff
History
Date User Action Args
2007-08-23 15:56:26adminlinkissue1648268 messages
2007-08-23 15:56:26admincreate