Patchwork [5,of,7] util: remove PyString* aliases on Python 3

login
register
mail settings
Submitter Gregory Szorc
Date Oct. 8, 2016, 8:48 p.m.
Message ID <a33e93c20bc1290af106.1475959691@gps-mbp.local>
Download mbox | patch
Permalink /patch/16964/
State Accepted
Headers show

Comments

Gregory Szorc - Oct. 8, 2016, 8:48 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1475957096 -7200
#      Sat Oct 08 22:04:56 2016 +0200
# Node ID a33e93c20bc1290af106a0f077fece735ea05245
# Parent  a91e68ef608ec814bd853f31920fe1f75993dd40
util: remove PyString* aliases on Python 3

We no longer have any users of the legacy PyString* functions. We no
longer need these redefinitions.

After this change, the only reference to "PyString" in the repo is in
watchman's C extension. That isn't our code and porting Mercurial
extensions to Python 3 is not a high priority at the moment. watchman's
C extension will be dealt with later.

Patch

diff --git a/mercurial/util.h b/mercurial/util.h
--- a/mercurial/util.h
+++ b/mercurial/util.h
@@ -19,49 +19,8 @@ 
 #define PyInt_Type PyLong_Type
 #define PyInt_FromLong PyLong_FromLong
 #define PyInt_AsLong PyLong_AsLong
 
-/*
- Mapping of some of the python < 2.x PyString* functions to py3k's PyUnicode.
-
- The commented names below represent those that are present in the PyBytes
- definitions for python < 2.6 (below in this file) that don't have a direct
- implementation.
-*/
-
-#define PyStringObject PyUnicodeObject
-#define PyString_Type PyUnicode_Type
-
-#define PyString_Check PyUnicode_Check
-#define PyString_CheckExact PyUnicode_CheckExact
-#define PyString_CHECK_INTERNED PyUnicode_CHECK_INTERNED
-#define PyString_AS_STRING PyUnicode_AsLatin1String
-#define PyString_GET_SIZE PyUnicode_GET_SIZE
-
-#define PyString_FromStringAndSize PyUnicode_FromStringAndSize
-#define PyString_FromString PyUnicode_FromString
-#define PyString_FromFormatV PyUnicode_FromFormatV
-#define PyString_FromFormat PyUnicode_FromFormat
-/* #define PyString_Size PyUnicode_GET_SIZE */
-/* #define PyString_AsString */
-/* #define PyString_Repr */
-#define PyString_Concat PyUnicode_Concat
-#define PyString_ConcatAndDel PyUnicode_AppendAndDel
-#define _PyString_Resize PyUnicode_Resize
-/* #define _PyString_Eq */
-#define PyString_Format PyUnicode_Format
-/* #define _PyString_FormatLong */
-/* #define PyString_DecodeEscape */
-#define _PyString_Join PyUnicode_Join
-#define PyString_Decode PyUnicode_Decode
-#define PyString_Encode PyUnicode_Encode
-#define PyString_AsEncodedObject PyUnicode_AsEncodedObject
-#define PyString_AsEncodedString PyUnicode_AsEncodedString
-#define PyString_AsDecodedObject PyUnicode_AsDecodedObject
-#define PyString_AsDecodedString PyUnicode_AsDecodedUnicode
-/* #define PyString_AsStringAndSize */
-#define _PyString_InsertThousandsGrouping _PyUnicode_InsertThousandsGrouping
-
 #endif /* PY_MAJOR_VERSION */
 
 typedef struct {
 	PyObject_HEAD