fonttools 4.59.0__cp310-cp310-win32.whl → 4.59.1__cp310-cp310-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fonttools might be problematic. Click here for more details.

Files changed (30) hide show
  1. fontTools/__init__.py +1 -1
  2. fontTools/cffLib/CFF2ToCFF.py +40 -10
  3. fontTools/cffLib/transforms.py +11 -6
  4. fontTools/cu2qu/cu2qu.c +30 -16
  5. fontTools/cu2qu/cu2qu.cp310-win32.pyd +0 -0
  6. fontTools/feaLib/builder.py +6 -1
  7. fontTools/feaLib/lexer.c +30 -16
  8. fontTools/feaLib/lexer.cp310-win32.pyd +0 -0
  9. fontTools/misc/bezierTools.c +33 -19
  10. fontTools/misc/bezierTools.cp310-win32.pyd +0 -0
  11. fontTools/misc/psCharStrings.py +17 -2
  12. fontTools/pens/momentsPen.c +20 -14
  13. fontTools/pens/momentsPen.cp310-win32.pyd +0 -0
  14. fontTools/qu2cu/qu2cu.c +32 -18
  15. fontTools/qu2cu/qu2cu.cp310-win32.pyd +0 -0
  16. fontTools/ttLib/tables/_g_v_a_r.py +6 -3
  17. fontTools/ttLib/tables/_h_m_t_x.py +7 -3
  18. fontTools/varLib/featureVars.py +8 -0
  19. fontTools/varLib/instancer/__init__.py +65 -5
  20. fontTools/varLib/iup.c +32 -18
  21. fontTools/varLib/iup.cp310-win32.pyd +0 -0
  22. fontTools/varLib/mutator.py +11 -0
  23. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/METADATA +24 -10
  24. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/RECORD +30 -30
  25. {fonttools-4.59.0.data → fonttools-4.59.1.data}/data/share/man/man1/ttx.1 +0 -0
  26. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/WHEEL +0 -0
  27. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/entry_points.txt +0 -0
  28. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/licenses/LICENSE +0 -0
  29. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/licenses/LICENSE.external +0 -0
  30. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/top_level.txt +0 -0
fontTools/__init__.py CHANGED
@@ -3,6 +3,6 @@ from fontTools.misc.loggingTools import configLogger
3
3
 
4
4
  log = logging.getLogger(__name__)
5
5
 
6
- version = __version__ = "4.59.0"
6
+ version = __version__ = "4.59.1"
7
7
 
8
8
  __all__ = ["version", "log", "configLogger"]
@@ -2,13 +2,17 @@
2
2
 
3
3
  from fontTools.ttLib import TTFont, newTable
4
4
  from fontTools.misc.cliTools import makeOutputFileName
5
+ from fontTools.misc.psCharStrings import T2StackUseExtractor
5
6
  from fontTools.cffLib import (
6
7
  TopDictIndex,
7
8
  buildOrder,
8
9
  buildDefaults,
9
10
  topDictOperators,
10
11
  privateDictOperators,
12
+ FDSelect,
11
13
  )
14
+ from .transforms import desubroutinizeCharString
15
+ from .specializer import specializeProgram
12
16
  from .width import optimizeWidths
13
17
  from collections import defaultdict
14
18
  import logging
@@ -27,7 +31,7 @@ def _convertCFF2ToCFF(cff, otFont):
27
31
  The CFF2 font cannot be variable. (TODO Accept those and convert to the
28
32
  default instance?)
29
33
 
30
- This assumes a decompiled CFF table. (i.e. that the object has been
34
+ This assumes a decompiled CFF2 table. (i.e. that the object has been
31
35
  filled via :meth:`decompile` and e.g. not loaded from XML.)"""
32
36
 
33
37
  cff.major = 1
@@ -51,9 +55,14 @@ def _convertCFF2ToCFF(cff, otFont):
51
55
  if hasattr(topDict, key):
52
56
  delattr(topDict, key)
53
57
 
54
- fdArray = topDict.FDArray
55
58
  charStrings = topDict.CharStrings
56
59
 
60
+ fdArray = topDict.FDArray
61
+ if not hasattr(topDict, "FDSelect"):
62
+ # FDSelect is optional in CFF2, but required in CFF.
63
+ fdSelect = topDict.FDSelect = FDSelect()
64
+ fdSelect.gidArray = [0] * len(charStrings.charStrings)
65
+
57
66
  defaults = buildDefaults(privateDictOperators)
58
67
  order = buildOrder(privateDictOperators)
59
68
  for fd in fdArray:
@@ -69,6 +78,7 @@ def _convertCFF2ToCFF(cff, otFont):
69
78
  if hasattr(privateDict, key):
70
79
  delattr(privateDict, key)
71
80
 
81
+ # Add ending operators
72
82
  for cs in charStrings.values():
73
83
  cs.decompile()
74
84
  cs.program.append("endchar")
@@ -100,23 +110,43 @@ def _convertCFF2ToCFF(cff, otFont):
100
110
  if width != private.defaultWidthX:
101
111
  cs.program.insert(0, width - private.nominalWidthX)
102
112
 
113
+ # Handle stack use since stack-depth is lower in CFF than in CFF2.
114
+ for glyphName in charStrings.keys():
115
+ cs, fdIndex = charStrings.getItemAndSelector(glyphName)
116
+ if fdIndex is None:
117
+ fdIndex = 0
118
+ private = fdArray[fdIndex].Private
119
+ extractor = T2StackUseExtractor(
120
+ getattr(private, "Subrs", []), cff.GlobalSubrs, private=private
121
+ )
122
+ stackUse = extractor.execute(cs)
123
+ if stackUse > 48: # CFF stack depth is 48
124
+ desubroutinizeCharString(cs)
125
+ cs.program = specializeProgram(cs.program)
126
+
127
+ # Unused subroutines are still in CFF2 (ie. lacking 'return' operator)
128
+ # because they were not decompiled when we added the 'return'.
129
+ # Moreover, some used subroutines may have become unused after the
130
+ # stack-use fixup. So we remove all unused subroutines now.
131
+ cff.remove_unused_subroutines()
132
+
103
133
  mapping = {
104
- name: ("cid" + str(n) if n else ".notdef")
134
+ name: ("cid" + str(n).zfill(5) if n else ".notdef")
105
135
  for n, name in enumerate(topDict.charset)
106
136
  }
107
137
  topDict.charset = [
108
- "cid" + str(n) if n else ".notdef" for n in range(len(topDict.charset))
138
+ "cid" + str(n).zfill(5) if n else ".notdef" for n in range(len(topDict.charset))
109
139
  ]
110
140
  charStrings.charStrings = {
111
141
  mapping[name]: v for name, v in charStrings.charStrings.items()
112
142
  }
113
143
 
114
- # I'm not sure why the following is *not* necessary. And it breaks
115
- # the output if I add it.
116
- # topDict.ROS = ("Adobe", "Identity", 0)
144
+ topDict.ROS = ("Adobe", "Identity", 0)
117
145
 
118
146
 
119
147
  def convertCFF2ToCFF(font, *, updatePostTable=True):
148
+ if "CFF2" not in font:
149
+ raise ValueError("Input font does not contain a CFF2 table.")
120
150
  cff = font["CFF2"].cff
121
151
  _convertCFF2ToCFF(cff, font)
122
152
  del font["CFF2"]
@@ -131,7 +161,7 @@ def convertCFF2ToCFF(font, *, updatePostTable=True):
131
161
 
132
162
 
133
163
  def main(args=None):
134
- """Convert CFF OTF font to CFF2 OTF font"""
164
+ """Convert CFF2 OTF font to CFF OTF font"""
135
165
  if args is None:
136
166
  import sys
137
167
 
@@ -140,8 +170,8 @@ def main(args=None):
140
170
  import argparse
141
171
 
142
172
  parser = argparse.ArgumentParser(
143
- "fonttools cffLib.CFFToCFF2",
144
- description="Upgrade a CFF font to CFF2.",
173
+ "fonttools cffLib.CFF2ToCFF",
174
+ description="Convert a non-variable CFF2 font to CFF.",
145
175
  )
146
176
  parser.add_argument(
147
177
  "input", metavar="INPUT.ttf", help="Input OTF file with CFF table."
@@ -94,17 +94,22 @@ class _DesubroutinizingT2Decompiler(SimpleT2Decompiler):
94
94
  cs._patches.append((index, subr._desubroutinized))
95
95
 
96
96
 
97
+ def desubroutinizeCharString(cs):
98
+ """Desubroutinize a charstring in-place."""
99
+ cs.decompile()
100
+ subrs = getattr(cs.private, "Subrs", [])
101
+ decompiler = _DesubroutinizingT2Decompiler(subrs, cs.globalSubrs, cs.private)
102
+ decompiler.execute(cs)
103
+ cs.program = cs._desubroutinized
104
+ del cs._desubroutinized
105
+
106
+
97
107
  def desubroutinize(cff):
98
108
  for fontName in cff.fontNames:
99
109
  font = cff[fontName]
100
110
  cs = font.CharStrings
101
111
  for c in cs.values():
102
- c.decompile()
103
- subrs = getattr(c.private, "Subrs", [])
104
- decompiler = _DesubroutinizingT2Decompiler(subrs, c.globalSubrs, c.private)
105
- decompiler.execute(c)
106
- c.program = c._desubroutinized
107
- del c._desubroutinized
112
+ desubroutinizeCharString(c)
108
113
  # Delete all the local subrs
109
114
  if hasattr(font, "FDArray"):
110
115
  for fd in font.FDArray:
fontTools/cu2qu/cu2qu.c CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated by Cython 3.1.2 */
1
+ /* Generated by Cython 3.1.3 */
2
2
 
3
3
  /* BEGIN: Cython Metadata
4
4
  {
@@ -32,8 +32,8 @@ END: Cython Metadata */
32
32
  #elif PY_VERSION_HEX < 0x03080000
33
33
  #error Cython requires Python 3.8+.
34
34
  #else
35
- #define __PYX_ABI_VERSION "3_1_2"
36
- #define CYTHON_HEX_VERSION 0x030102F0
35
+ #define __PYX_ABI_VERSION "3_1_3"
36
+ #define CYTHON_HEX_VERSION 0x030103F0
37
37
  #define CYTHON_FUTURE_DIVISION 1
38
38
  /* CModulePreamble */
39
39
  #include <stddef.h>
@@ -396,6 +396,9 @@ END: Cython Metadata */
396
396
  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
397
397
  #endif
398
398
  #endif
399
+ #ifndef CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME
400
+ #define CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME 100
401
+ #endif
399
402
  #ifndef __has_attribute
400
403
  #define __has_attribute(x) 0
401
404
  #endif
@@ -8052,16 +8055,15 @@ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
8052
8055
  return -1;
8053
8056
  }
8054
8057
  /* #### Code section: init_codeobjects ### */
8055
- \
8056
- typedef struct {
8057
- unsigned int argcount : 3;
8058
- unsigned int num_posonly_args : 1;
8059
- unsigned int num_kwonly_args : 1;
8060
- unsigned int nlocals : 5;
8061
- unsigned int flags : 10;
8062
- unsigned int first_line : 9;
8063
- unsigned int line_table_length : 13;
8064
- } __Pyx_PyCode_New_function_description;
8058
+ typedef struct {
8059
+ unsigned int argcount : 3;
8060
+ unsigned int num_posonly_args : 1;
8061
+ unsigned int num_kwonly_args : 1;
8062
+ unsigned int nlocals : 5;
8063
+ unsigned int flags : 10;
8064
+ unsigned int first_line : 9;
8065
+ unsigned int line_table_length : 13;
8066
+ } __Pyx_PyCode_New_function_description;
8065
8067
  /* NewCodeObj.proto */
8066
8068
  static PyObject* __Pyx_PyCode_New(
8067
8069
  const __Pyx_PyCode_New_function_description descr,
@@ -10305,6 +10307,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
10305
10307
  changed = 1;
10306
10308
  }
10307
10309
  #endif // CYTHON_METH_FASTCALL
10310
+ #if !CYTHON_COMPILING_IN_PYPY
10308
10311
  else if (strcmp(memb->name, "__module__") == 0) {
10309
10312
  PyObject *descr;
10310
10313
  assert(memb->type == T_OBJECT);
@@ -10319,11 +10322,13 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
10319
10322
  }
10320
10323
  changed = 1;
10321
10324
  }
10325
+ #endif // !CYTHON_COMPILING_IN_PYPY
10322
10326
  }
10323
10327
  memb++;
10324
10328
  }
10325
10329
  }
10326
10330
  #endif // !CYTHON_COMPILING_IN_LIMITED_API
10331
+ #if !CYTHON_COMPILING_IN_PYPY
10327
10332
  slot = spec->slots;
10328
10333
  while (slot && slot->slot && slot->slot != Py_tp_getset)
10329
10334
  slot++;
@@ -10355,6 +10360,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
10355
10360
  ++getset;
10356
10361
  }
10357
10362
  }
10363
+ #endif // !CYTHON_COMPILING_IN_PYPY
10358
10364
  if (changed)
10359
10365
  PyType_Modified(type);
10360
10366
  #endif // PY_VERSION_HEX > 0x030900B1
@@ -10465,6 +10471,13 @@ try_unpack:
10465
10471
 
10466
10472
  /* PyObjectCallMethod0 */
10467
10473
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
10474
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
10475
+ PyObject *args[1] = {obj};
10476
+ (void) __Pyx_PyObject_GetMethod;
10477
+ (void) __Pyx_PyObject_CallOneArg;
10478
+ (void) __Pyx_PyObject_CallNoArg;
10479
+ return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
10480
+ #else
10468
10481
  PyObject *method = NULL, *result = NULL;
10469
10482
  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
10470
10483
  if (likely(is_method)) {
@@ -10477,6 +10490,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name
10477
10490
  Py_DECREF(method);
10478
10491
  bad:
10479
10492
  return result;
10493
+ #endif
10480
10494
  }
10481
10495
 
10482
10496
  /* ValidateBasesTuple */
@@ -11088,7 +11102,7 @@ bad:
11088
11102
  }
11089
11103
 
11090
11104
  /* CommonTypesMetaclass */
11091
- PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
11105
+ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
11092
11106
  return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
11093
11107
  }
11094
11108
  static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
@@ -13654,7 +13668,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyOb
13654
13668
  }
13655
13669
 
13656
13670
  /* PyObjectCallMethod1 */
13657
- #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000)
13671
+ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
13658
13672
  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
13659
13673
  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
13660
13674
  Py_DECREF(method);
@@ -13662,7 +13676,7 @@ static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
13662
13676
  }
13663
13677
  #endif
13664
13678
  static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
13665
- #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
13679
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
13666
13680
  PyObject *args[2] = {obj, arg};
13667
13681
  (void) __Pyx_PyObject_GetMethod;
13668
13682
  (void) __Pyx_PyObject_CallOneArg;
Binary file
@@ -926,6 +926,11 @@ class Builder(object):
926
926
  l.lookup_index for l in lookups if l.lookup_index is not None
927
927
  )
928
928
  )
929
+ # order doesn't matter, but lookup_indices preserves it.
930
+ # We want to combine identical sets of lookups (order doesn't matter)
931
+ # but also respect the order provided by the user (although there's
932
+ # a reasonable argument to just sort and dedupe, which fontc does)
933
+ lookup_key = frozenset(lookup_indices)
929
934
 
930
935
  size_feature = tag == "GPOS" and feature_tag == "size"
931
936
  force_feature = self.any_feature_variations(feature_tag, tag)
@@ -943,7 +948,7 @@ class Builder(object):
943
948
  "stash debug information. See fonttools#2065."
944
949
  )
945
950
 
946
- feature_key = (feature_tag, lookup_indices)
951
+ feature_key = (feature_tag, lookup_key)
947
952
  feature_index = feature_indices.get(feature_key)
948
953
  if feature_index is None:
949
954
  feature_index = len(table.FeatureList.FeatureRecord)
fontTools/feaLib/lexer.c CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated by Cython 3.1.2 */
1
+ /* Generated by Cython 3.1.3 */
2
2
 
3
3
  /* BEGIN: Cython Metadata
4
4
  {
@@ -26,8 +26,8 @@ END: Cython Metadata */
26
26
  #elif PY_VERSION_HEX < 0x03080000
27
27
  #error Cython requires Python 3.8+.
28
28
  #else
29
- #define __PYX_ABI_VERSION "3_1_2"
30
- #define CYTHON_HEX_VERSION 0x030102F0
29
+ #define __PYX_ABI_VERSION "3_1_3"
30
+ #define CYTHON_HEX_VERSION 0x030103F0
31
31
  #define CYTHON_FUTURE_DIVISION 1
32
32
  /* CModulePreamble */
33
33
  #include <stddef.h>
@@ -390,6 +390,9 @@ END: Cython Metadata */
390
390
  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
391
391
  #endif
392
392
  #endif
393
+ #ifndef CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME
394
+ #define CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME 100
395
+ #endif
393
396
  #ifndef __has_attribute
394
397
  #define __has_attribute(x) 0
395
398
  #endif
@@ -10822,16 +10825,15 @@ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
10822
10825
  return -1;
10823
10826
  }
10824
10827
  /* #### Code section: init_codeobjects ### */
10825
- \
10826
- typedef struct {
10827
- unsigned int argcount : 2;
10828
- unsigned int num_posonly_args : 1;
10829
- unsigned int num_kwonly_args : 1;
10830
- unsigned int nlocals : 4;
10831
- unsigned int flags : 10;
10832
- unsigned int first_line : 9;
10833
- unsigned int line_table_length : 15;
10834
- } __Pyx_PyCode_New_function_description;
10828
+ typedef struct {
10829
+ unsigned int argcount : 2;
10830
+ unsigned int num_posonly_args : 1;
10831
+ unsigned int num_kwonly_args : 1;
10832
+ unsigned int nlocals : 4;
10833
+ unsigned int flags : 10;
10834
+ unsigned int first_line : 9;
10835
+ unsigned int line_table_length : 15;
10836
+ } __Pyx_PyCode_New_function_description;
10835
10837
  /* NewCodeObj.proto */
10836
10838
  static PyObject* __Pyx_PyCode_New(
10837
10839
  const __Pyx_PyCode_New_function_description descr,
@@ -13414,6 +13416,13 @@ try_unpack:
13414
13416
 
13415
13417
  /* PyObjectCallMethod0 */
13416
13418
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
13419
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
13420
+ PyObject *args[1] = {obj};
13421
+ (void) __Pyx_PyObject_GetMethod;
13422
+ (void) __Pyx_PyObject_CallOneArg;
13423
+ (void) __Pyx_PyObject_CallNoArg;
13424
+ return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
13425
+ #else
13417
13426
  PyObject *method = NULL, *result = NULL;
13418
13427
  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
13419
13428
  if (likely(is_method)) {
@@ -13426,6 +13435,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name
13426
13435
  Py_DECREF(method);
13427
13436
  bad:
13428
13437
  return result;
13438
+ #endif
13429
13439
  }
13430
13440
 
13431
13441
  /* CallUnboundCMethod0 */
@@ -13493,7 +13503,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyOb
13493
13503
  }
13494
13504
 
13495
13505
  /* PyObjectCallMethod1 */
13496
- #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000)
13506
+ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
13497
13507
  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
13498
13508
  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
13499
13509
  Py_DECREF(method);
@@ -13501,7 +13511,7 @@ static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
13501
13511
  }
13502
13512
  #endif
13503
13513
  static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
13504
- #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
13514
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
13505
13515
  PyObject *args[2] = {obj, arg};
13506
13516
  (void) __Pyx_PyObject_GetMethod;
13507
13517
  (void) __Pyx_PyObject_CallOneArg;
@@ -14087,6 +14097,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
14087
14097
  changed = 1;
14088
14098
  }
14089
14099
  #endif // CYTHON_METH_FASTCALL
14100
+ #if !CYTHON_COMPILING_IN_PYPY
14090
14101
  else if (strcmp(memb->name, "__module__") == 0) {
14091
14102
  PyObject *descr;
14092
14103
  assert(memb->type == T_OBJECT);
@@ -14101,11 +14112,13 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
14101
14112
  }
14102
14113
  changed = 1;
14103
14114
  }
14115
+ #endif // !CYTHON_COMPILING_IN_PYPY
14104
14116
  }
14105
14117
  memb++;
14106
14118
  }
14107
14119
  }
14108
14120
  #endif // !CYTHON_COMPILING_IN_LIMITED_API
14121
+ #if !CYTHON_COMPILING_IN_PYPY
14109
14122
  slot = spec->slots;
14110
14123
  while (slot && slot->slot && slot->slot != Py_tp_getset)
14111
14124
  slot++;
@@ -14137,6 +14150,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
14137
14150
  ++getset;
14138
14151
  }
14139
14152
  }
14153
+ #endif // !CYTHON_COMPILING_IN_PYPY
14140
14154
  if (changed)
14141
14155
  PyType_Modified(type);
14142
14156
  #endif // PY_VERSION_HEX > 0x030900B1
@@ -14269,7 +14283,7 @@ bad:
14269
14283
  }
14270
14284
 
14271
14285
  /* CommonTypesMetaclass */
14272
- PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
14286
+ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
14273
14287
  return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
14274
14288
  }
14275
14289
  static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
Binary file
@@ -1,4 +1,4 @@
1
- /* Generated by Cython 3.1.2 */
1
+ /* Generated by Cython 3.1.3 */
2
2
 
3
3
  /* BEGIN: Cython Metadata
4
4
  {
@@ -26,8 +26,8 @@ END: Cython Metadata */
26
26
  #elif PY_VERSION_HEX < 0x03080000
27
27
  #error Cython requires Python 3.8+.
28
28
  #else
29
- #define __PYX_ABI_VERSION "3_1_2"
30
- #define CYTHON_HEX_VERSION 0x030102F0
29
+ #define __PYX_ABI_VERSION "3_1_3"
30
+ #define CYTHON_HEX_VERSION 0x030103F0
31
31
  #define CYTHON_FUTURE_DIVISION 1
32
32
  /* CModulePreamble */
33
33
  #include <stddef.h>
@@ -390,6 +390,9 @@ END: Cython Metadata */
390
390
  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
391
391
  #endif
392
392
  #endif
393
+ #ifndef CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME
394
+ #define CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME 100
395
+ #endif
393
396
  #ifndef __has_attribute
394
397
  #define __has_attribute(x) 0
395
398
  #endif
@@ -2390,7 +2393,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2
2390
2393
  static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
2391
2394
  #define __Pyx_PyNumber_Absolute(x)\
2392
2395
  ((likely(PyLong_CheckExact(x))) ?\
2393
- (likely(__Pyx_PyLong_IsNonNeg(x)) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
2396
+ (likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) :\
2394
2397
  PyNumber_Absolute(x))
2395
2398
  #else
2396
2399
  #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
@@ -3261,7 +3264,7 @@ static const char __pyx_k_segmentPointAtT[] = "segmentPointAtT";
3261
3264
  static const char __pyx_k_splitCubicAtT_2[] = "splitCubicAtT";
3262
3265
  static const char __pyx_k_transformPoints[] = "transformPoints";
3263
3266
  static const char __pyx_k_1_a_r_wb_gRvWBfA[] = "\320\000+\2501\360\034\000\005\014\320\013\036\230a\330\010\017\210r\220\026\220w\230b\240\006\240g\250R\250v\260W\270B\270f\300A";
3264
- static const char __pyx_k_s_3c_A_AS_1_b_AQ[] = "\200\001\330\004\007\200s\210!\2103\210c\220\021\330\010\017\320\017\"\240\"\240A\330\t\014\210A\210S\220\003\2201\330\010\017\210\230b\240\001\330\004\n\210*\220A\220Q";
3267
+ static const char __pyx_k_s_3c_A_AS_1_b_AQ[] = "\200\001\330\004\007\200s\210!\2103\210c\220\021\330\010\017\320\017\"\240\"\240A\330\t\014\210A\210S\220\003\2201\330\010\017\210\177\230b\240\001\330\004\n\210*\220A\220Q";
3265
3268
  static const char __pyx_k_splitCubicAtTC_2[] = "_splitCubicAtTC";
3266
3269
  static const char __pyx_k_quadraticPointAtT[] = "quadraticPointAtT";
3267
3270
  static const char __pyx_k_splitQuadraticAtT[] = "_splitQuadraticAtT";
@@ -31612,16 +31615,15 @@ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
31612
31615
  return -1;
31613
31616
  }
31614
31617
  /* #### Code section: init_codeobjects ### */
31615
- \
31616
- typedef struct {
31617
- unsigned int argcount : 3;
31618
- unsigned int num_posonly_args : 1;
31619
- unsigned int num_kwonly_args : 1;
31620
- unsigned int nlocals : 6;
31621
- unsigned int flags : 10;
31622
- unsigned int first_line : 11;
31623
- unsigned int line_table_length : 14;
31624
- } __Pyx_PyCode_New_function_description;
31618
+ typedef struct {
31619
+ unsigned int argcount : 3;
31620
+ unsigned int num_posonly_args : 1;
31621
+ unsigned int num_kwonly_args : 1;
31622
+ unsigned int nlocals : 6;
31623
+ unsigned int flags : 10;
31624
+ unsigned int first_line : 11;
31625
+ unsigned int line_table_length : 14;
31626
+ } __Pyx_PyCode_New_function_description;
31625
31627
  /* NewCodeObj.proto */
31626
31628
  static PyObject* __Pyx_PyCode_New(
31627
31629
  const __Pyx_PyCode_New_function_description descr,
@@ -34135,6 +34137,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
34135
34137
  changed = 1;
34136
34138
  }
34137
34139
  #endif // CYTHON_METH_FASTCALL
34140
+ #if !CYTHON_COMPILING_IN_PYPY
34138
34141
  else if (strcmp(memb->name, "__module__") == 0) {
34139
34142
  PyObject *descr;
34140
34143
  assert(memb->type == T_OBJECT);
@@ -34149,11 +34152,13 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
34149
34152
  }
34150
34153
  changed = 1;
34151
34154
  }
34155
+ #endif // !CYTHON_COMPILING_IN_PYPY
34152
34156
  }
34153
34157
  memb++;
34154
34158
  }
34155
34159
  }
34156
34160
  #endif // !CYTHON_COMPILING_IN_LIMITED_API
34161
+ #if !CYTHON_COMPILING_IN_PYPY
34157
34162
  slot = spec->slots;
34158
34163
  while (slot && slot->slot && slot->slot != Py_tp_getset)
34159
34164
  slot++;
@@ -34185,6 +34190,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
34185
34190
  ++getset;
34186
34191
  }
34187
34192
  }
34193
+ #endif // !CYTHON_COMPILING_IN_PYPY
34188
34194
  if (changed)
34189
34195
  PyType_Modified(type);
34190
34196
  #endif // PY_VERSION_HEX > 0x030900B1
@@ -34317,7 +34323,7 @@ bad:
34317
34323
  }
34318
34324
 
34319
34325
  /* CommonTypesMetaclass */
34320
- PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
34326
+ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
34321
34327
  return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
34322
34328
  }
34323
34329
  static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
@@ -34735,7 +34741,7 @@ try_unpack:
34735
34741
  }
34736
34742
 
34737
34743
  /* PyObjectCallMethod1 */
34738
- #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000)
34744
+ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
34739
34745
  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
34740
34746
  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
34741
34747
  Py_DECREF(method);
@@ -34743,7 +34749,7 @@ static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
34743
34749
  }
34744
34750
  #endif
34745
34751
  static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
34746
- #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
34752
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
34747
34753
  PyObject *args[2] = {obj, arg};
34748
34754
  (void) __Pyx_PyObject_GetMethod;
34749
34755
  (void) __Pyx_PyObject_CallOneArg;
@@ -36076,7 +36082,7 @@ static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
36076
36082
  PyObject *copy = _PyLong_Copy((PyLongObject*)n);
36077
36083
  if (likely(copy)) {
36078
36084
  #if PY_VERSION_HEX >= 0x030C00A7
36079
- ((PyLongObject*)copy)->long_value.lv_tag = ((PyLongObject*)copy)->long_value.lv_tag & ~_PyLong_SIGN_MASK;
36085
+ ((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
36080
36086
  #else
36081
36087
  __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
36082
36088
  #endif
@@ -37773,6 +37779,13 @@ static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, in
37773
37779
 
37774
37780
  /* PyObjectCallMethod0 */
37775
37781
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
37782
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
37783
+ PyObject *args[1] = {obj};
37784
+ (void) __Pyx_PyObject_GetMethod;
37785
+ (void) __Pyx_PyObject_CallOneArg;
37786
+ (void) __Pyx_PyObject_CallNoArg;
37787
+ return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
37788
+ #else
37776
37789
  PyObject *method = NULL, *result = NULL;
37777
37790
  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
37778
37791
  if (likely(is_method)) {
@@ -37785,6 +37798,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name
37785
37798
  Py_DECREF(method);
37786
37799
  bad:
37787
37800
  return result;
37801
+ #endif
37788
37802
  }
37789
37803
 
37790
37804
  /* ValidateBasesTuple */
Binary file
@@ -338,7 +338,7 @@ class SimpleT2Decompiler(object):
338
338
  self.numRegions = 0
339
339
  self.vsIndex = 0
340
340
 
341
- def execute(self, charString):
341
+ def execute(self, charString, *, pushToStack=None):
342
342
  self.callingStack.append(charString)
343
343
  needsDecompilation = charString.needsDecompilation()
344
344
  if needsDecompilation:
@@ -346,7 +346,8 @@ class SimpleT2Decompiler(object):
346
346
  pushToProgram = program.append
347
347
  else:
348
348
  pushToProgram = lambda x: None
349
- pushToStack = self.operandStack.append
349
+ if pushToStack is None:
350
+ pushToStack = self.operandStack.append
350
351
  index = 0
351
352
  while True:
352
353
  token, isOperator, index = charString.getToken(index)
@@ -551,6 +552,20 @@ t1Operators = [
551
552
  ]
552
553
 
553
554
 
555
+ class T2StackUseExtractor(SimpleT2Decompiler):
556
+
557
+ def execute(self, charString):
558
+ maxStackUse = 0
559
+
560
+ def pushToStack(value):
561
+ nonlocal maxStackUse
562
+ self.operandStack.append(value)
563
+ maxStackUse = max(maxStackUse, len(self.operandStack))
564
+
565
+ super().execute(charString, pushToStack=pushToStack)
566
+ return maxStackUse
567
+
568
+
554
569
  class T2WidthExtractor(SimpleT2Decompiler):
555
570
  def __init__(
556
571
  self,