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.

classification
Title: Remove deprecated C "character" handling macros ISUPPER() etc
Type: Stage: resolved
Components: Versions: Python 3.2
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: dmalcolm, eric.smith, lemburg, mark.dickinson
Priority: normal Keywords: patch

Created on 2010-11-01 22:41 by dmalcolm, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
py3k-remove-old-char-compat-macros.patch dmalcolm, 2010-11-01 22:41 review
Messages (6)
msg120185 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-11-01 22:41
Issue 5793 rationalized all usage of C "character" handling to use "Py_"-prefixed locale-unaware macros, at the "char" level.

In particular, this comment was added in two places to Include/bytes_methods.h in r72044:
http://svn.python.org/view/python/branches/py3k/Include/bytes_methods.h?view=diff&r1=72043&r2=72044

  /* These are left in for backward compatibility and will be removed
  in 2.8/3.2 */

Given that 3.2 is coming soon, is it time to remove these?  (also, the reference to "2.8" caught my eye)

Attached is a patch to py3k which removes them, and fixes up various users that were still in the source tree.

Am I right in thinking that the undef and redefinition of the various lower-case macros from <ctype.h> was already intended to be removed? (given that this messes about with a standard C library)
msg120212 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2010-11-02 09:50
Dave Malcolm wrote:
> 
> New submission from Dave Malcolm <dmalcolm@redhat.com>:
> 
> Issue 5793 rationalized all usage of C "character" handling to use "Py_"-prefixed locale-unaware macros, at the "char" level.
> 
> In particular, this comment was added in two places to Include/bytes_methods.h in r72044:
> http://svn.python.org/view/python/branches/py3k/Include/bytes_methods.h?view=diff&r1=72043&r2=72044
> 
>   /* These are left in for backward compatibility and will be removed
>   in 2.8/3.2 */
> 
> Given that 3.2 is coming soon, is it time to remove these?  (also, the reference to "2.8" caught my eye)

+1

> Attached is a patch to py3k which removes them, and fixes up various users that were still in the source tree.
> 
> Am I right in thinking that the undef and redefinition of the various lower-case macros from <ctype.h> was already intended to be removed? (given that this messes about with a standard C library)

Please remove those as well. I suppose those were mainly used to find
instances of islower() et al. in the source code.
msg120223 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2010-11-02 13:51
+1

I agree on removing the lowercase versions. It's sort of handy having them around to prevent accidental uses. But the same could be said for other similar macros/functions. Plus they wouldn't work if the isXXX symbols were really functions, not macros (not that I know if that's even allowed by the standard).

The patch looks okay to me, although I didn't actually compile and run the tests. You'll find out soon enough! The issue number in the NEWS entry needs to be fixed, of course.

Thanks for doing this, Dave.
msg120512 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-11-05 17:18
Thanks for reviewing.

If I'm reading things correctly, the ISUPPER et al macros were added in 2.6 and 3.0, and deprecated in 2.7 and 3.1.

Tested with a full run of "-m test.regrtest -uall" here (x86_64 Fedora 13), with both 2-byte and 4-byte unicode; no failures:
    342 tests OK.
    7 tests skipped:
        test_gdb test_kqueue test_ossaudiodev test_startfile test_winreg
        test_winsound test_zipfile64
    Those skips are all expected on linux2.

I've fixed up the issue number in Misc/NEWS in my local tree.

The patch as-is doesn't make sense for 3.1 or 2.7 (the macros should remain within the maintenance branches, in deprecated form) - do I need to explicitly mark this revision (e.g. using "svnmerge.py block"?)
msg120513 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2010-11-05 17:20
I'd 'svnmerge block' them, just in case anyone decides to manually merge (which I doubt will happen, but you never know).
msg120514 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-11-05 17:25
Committed to py3k in r86210
History
Date User Action Args
2022-04-11 14:57:08adminsetgithub: 54497
2011-03-15 18:35:39dmalcolmsetstatus: open -> closed
nosy: lemburg, mark.dickinson, eric.smith, dmalcolm
versions: - Python 3.3
resolution: accepted
stage: patch review -> resolved
2010-11-05 17:25:37dmalcolmsetmessages: + msg120514
2010-11-05 17:20:37eric.smithsetmessages: + msg120513
2010-11-05 17:18:20dmalcolmsetmessages: + msg120512
2010-11-02 13:51:09eric.smithsetmessages: + msg120223
2010-11-02 10:32:45lemburgsettitle: Remove -> Remove deprecated C "character" handling macros ISUPPER() etc
2010-11-02 09:50:22lemburgsetnosy: + lemburg
title: Remove deprecated C "character" handling macros ISUPPER() etc -> Remove
messages: + msg120212
2010-11-01 22:42:11dmalcolmsettitle: Remove -> Remove deprecated C "character" handling macros ISUPPER() etc
2010-11-01 22:41:45dmalcolmcreate