@@ -243,40 +243,6 @@ PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
243
243
(assert(PyUnicode_Check(op)), (PyUnicodeObject*)(op))
244
244
245
245
246
- /* Fast access macros */
247
-
248
- /* Returns the deprecated Py_UNICODE representation's size in code units
249
- (this includes surrogate pairs as 2 units).
250
- If the Py_UNICODE representation is not available, it will be computed
251
- on request. Use PyUnicode_GET_LENGTH() for the length in code points. */
252
-
253
- /* Py_DEPRECATED(3.3) */
254
- #define PyUnicode_GET_SIZE (op ) \
255
- (_PyASCIIObject_CAST(op)->wstr ? \
256
- PyUnicode_WSTR_LENGTH (op) : \
257
- ((void )PyUnicode_AsUnicode(_PyObject_CAST(op)),\
258
- assert(_PyASCIIObject_CAST(op)->wstr), \
259
- PyUnicode_WSTR_LENGTH(op)))
260
-
261
- /* Py_DEPRECATED(3.3) */
262
- #define PyUnicode_GET_DATA_SIZE (op ) \
263
- (PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
264
-
265
- /* Alias for PyUnicode_AsUnicode(). This will create a wchar_t/Py_UNICODE
266
- representation on demand. Using this macro is very inefficient now,
267
- try to port your code to use the new PyUnicode_*BYTE_DATA() macros or
268
- use PyUnicode_WRITE() and PyUnicode_READ(). */
269
-
270
- /* Py_DEPRECATED(3.3) */
271
- #define PyUnicode_AS_UNICODE (op ) \
272
- (_PyASCIIObject_CAST(op)->wstr ? _PyASCIIObject_CAST(op)->wstr : \
273
- PyUnicode_AsUnicode (_PyObject_CAST(op)))
274
-
275
- /* Py_DEPRECATED(3.3) */
276
- #define PyUnicode_AS_DATA (op ) \
277
- ((const char *)(PyUnicode_AS_UNICODE(op)))
278
-
279
-
280
246
/* --- Flexible String Representation Helper Macros (PEP 393) -------------- */
281
247
282
248
/* Values for PyASCIIObject.state: */
@@ -458,14 +424,6 @@ static inline Py_UCS4 PyUnicode_MAX_CHAR_VALUE(PyObject *op)
458
424
#define PyUnicode_MAX_CHAR_VALUE (op ) \
459
425
PyUnicode_MAX_CHAR_VALUE (_PyObject_CAST(op))
460
426
461
- Py_DEPRECATED(3.3 )
462
- static inline Py_ssize_t PyUnicode_WSTR_LENGTH(PyObject *op) {
463
- return PyUnicode_IS_COMPACT_ASCII (op) ?
464
- _PyASCIIObject_CAST (op)->length :
465
- _PyCompactUnicodeObject_CAST (op)->wstr_length ;
466
- }
467
- #define PyUnicode_WSTR_LENGTH (op ) PyUnicode_WSTR_LENGTH(_PyObject_CAST(op))
468
-
469
427
/* === Public API ========================================================= */
470
428
471
429
/* --- Plain Py_UNICODE --------------------------------------------------- */
@@ -568,20 +526,6 @@ PyAPI_FUNC(void) _PyUnicode_FastFill(
568
526
Py_UCS4 fill_char
569
527
);
570
528
571
- /* Create a Unicode Object from the Py_UNICODE buffer u of the given
572
- size.
573
-
574
- u may be NULL which causes the contents to be undefined. It is the
575
- user's responsibility to fill in the needed data afterwards. Note
576
- that modifying the Unicode object contents after construction is
577
- only allowed if u was set to NULL.
578
-
579
- The buffer is copied into the new object. */
580
- Py_DEPRECATED (3.3 ) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
581
- const Py_UNICODE *u, /* Unicode buffer */
582
- Py_ssize_t size /* size of buffer */
583
- );
584
-
585
529
/* Create a new string from a buffer of Py_UCS1, Py_UCS2 or Py_UCS4 characters.
586
530
Scan the string to find the maximum character. */
587
531
PyAPI_FUNC (PyObject*) PyUnicode_FromKindAndData(
@@ -602,6 +546,22 @@ PyAPI_FUNC(Py_UCS4) _PyUnicode_FindMaxChar (
602
546
Py_ssize_t start,
603
547
Py_ssize_t end);
604
548
549
+ /* --- Legacy deprecated API ---------------------------------------------- */
550
+
551
+ /* Create a Unicode Object from the Py_UNICODE buffer u of the given
552
+ size.
553
+
554
+ u may be NULL which causes the contents to be undefined. It is the
555
+ user's responsibility to fill in the needed data afterwards. Note
556
+ that modifying the Unicode object contents after construction is
557
+ only allowed if u was set to NULL.
558
+
559
+ The buffer is copied into the new object. */
560
+ Py_DEPRECATED (3.3 ) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
561
+ const Py_UNICODE *u, /* Unicode buffer */
562
+ Py_ssize_t size /* size of buffer */
563
+ );
564
+
605
565
/* Return a read-only pointer to the Unicode object's internal
606
566
Py_UNICODE buffer.
607
567
If the wchar_t/Py_UNICODE representation is not yet available, this
@@ -627,6 +587,48 @@ Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicodeAndSize(
627
587
);
628
588
629
589
590
+ /* Fast access macros */
591
+
592
+ Py_DEPRECATED (3.3 )
593
+ static inline Py_ssize_t PyUnicode_WSTR_LENGTH(PyObject *op) {
594
+ return PyUnicode_IS_COMPACT_ASCII (op) ?
595
+ _PyASCIIObject_CAST (op)->length :
596
+ _PyCompactUnicodeObject_CAST (op)->wstr_length ;
597
+ }
598
+ #define PyUnicode_WSTR_LENGTH (op ) PyUnicode_WSTR_LENGTH(_PyObject_CAST(op))
599
+
600
+ /* Returns the deprecated Py_UNICODE representation's size in code units
601
+ (this includes surrogate pairs as 2 units).
602
+ If the Py_UNICODE representation is not available, it will be computed
603
+ on request. Use PyUnicode_GET_LENGTH() for the length in code points. */
604
+
605
+ /* Py_DEPRECATED(3.3) */
606
+ #define PyUnicode_GET_SIZE (op ) \
607
+ (_PyASCIIObject_CAST(op)->wstr ? \
608
+ PyUnicode_WSTR_LENGTH (op) : \
609
+ ((void )PyUnicode_AsUnicode(_PyObject_CAST(op)),\
610
+ assert(_PyASCIIObject_CAST(op)->wstr), \
611
+ PyUnicode_WSTR_LENGTH(op)))
612
+
613
+ /* Py_DEPRECATED(3.3) */
614
+ #define PyUnicode_GET_DATA_SIZE (op ) \
615
+ (PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)
616
+
617
+ /* Alias for PyUnicode_AsUnicode(). This will create a wchar_t/Py_UNICODE
618
+ representation on demand. Using this macro is very inefficient now,
619
+ try to port your code to use the new PyUnicode_*BYTE_DATA() macros or
620
+ use PyUnicode_WRITE() and PyUnicode_READ(). */
621
+
622
+ /* Py_DEPRECATED(3.3) */
623
+ #define PyUnicode_AS_UNICODE (op ) \
624
+ (_PyASCIIObject_CAST(op)->wstr ? _PyASCIIObject_CAST(op)->wstr : \
625
+ PyUnicode_AsUnicode (_PyObject_CAST(op)))
626
+
627
+ /* Py_DEPRECATED(3.3) */
628
+ #define PyUnicode_AS_DATA (op ) \
629
+ ((const char *)(PyUnicode_AS_UNICODE(op)))
630
+
631
+
630
632
/* --- _PyUnicodeWriter API ----------------------------------------------- */
631
633
632
634
typedef struct {
0 commit comments