Skip to content
This repository was archived by the owner on Feb 12, 2023. It is now read-only.

Commit aeee113

Browse files
author
twoone3
committed
update python 3.10.7
1 parent ef28abf commit aeee113

File tree

9 files changed

+44
-13
lines changed

9 files changed

+44
-13
lines changed

SDK

Submodule SDK updated from 4703d95 to 8797133

include/internal/pycore_atomic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ _Py_ANNOTATE_MEMORY_ORDER(const volatile void *address, _Py_memory_order order)
236236
in hardware they will fall back to a full memory barrier as well.
237237
238238
This might affect performance but likely only in some very specific and
239-
hard to meassure scenario.
239+
hard to measure scenario.
240240
*/
241241
#if defined(_M_IX86) || defined(_M_X64)
242242
typedef enum _Py_memory_order {

include/internal/pycore_initconfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ extern PyStatus _PyConfig_SetPyArgv(
165165
PyAPI_FUNC(PyObject*) _PyConfig_AsDict(const PyConfig *config);
166166
PyAPI_FUNC(int) _PyConfig_FromDict(PyConfig *config, PyObject *dict);
167167

168+
extern int _Py_global_config_int_max_str_digits;
169+
168170

169171
/* --- Function used for testing ---------------------------------- */
170172

include/internal/pycore_interp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ struct _is {
305305

306306
struct ast_state ast;
307307
struct type_cache type_cache;
308+
309+
int int_max_str_digits;
308310
};
309311

310312
extern void _PyInterpreterState_ClearModules(PyInterpreterState *interp);

include/internal/pycore_long.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,41 @@ extern "C" {
1111
#include "pycore_interp.h" // PyInterpreterState.small_ints
1212
#include "pycore_pystate.h" // _PyThreadState_GET()
1313

14+
/*
15+
* Default int base conversion size limitation: Denial of Service prevention.
16+
*
17+
* Chosen such that this isn't wildly slow on modern hardware and so that
18+
* everyone's existing deployed numpy test suite passes before
19+
* https://github.com/numpy/numpy/issues/22098 is widely available.
20+
*
21+
* $ python -m timeit -s 's = "1"*4300' 'int(s)'
22+
* 2000 loops, best of 5: 125 usec per loop
23+
* $ python -m timeit -s 's = "1"*4300; v = int(s)' 'str(v)'
24+
* 1000 loops, best of 5: 311 usec per loop
25+
* (zen2 cloud VM)
26+
*
27+
* 4300 decimal digits fits a ~14284 bit number.
28+
*/
29+
#define _PY_LONG_DEFAULT_MAX_STR_DIGITS 4300
30+
/*
31+
* Threshold for max digits check. For performance reasons int() and
32+
* int.__str__() don't checks values that are smaller than this
33+
* threshold. Acts as a guaranteed minimum size limit for bignums that
34+
* applications can expect from CPython.
35+
*
36+
* % python -m timeit -s 's = "1"*640; v = int(s)' 'str(int(s))'
37+
* 20000 loops, best of 5: 12 usec per loop
38+
*
39+
* "640 digits should be enough for anyone." - gps
40+
* fits a ~2126 bit decimal number.
41+
*/
42+
#define _PY_LONG_MAX_STR_DIGITS_THRESHOLD 640
43+
44+
#if ((_PY_LONG_DEFAULT_MAX_STR_DIGITS != 0) && \
45+
(_PY_LONG_DEFAULT_MAX_STR_DIGITS < _PY_LONG_MAX_STR_DIGITS_THRESHOLD))
46+
# error "_PY_LONG_DEFAULT_MAX_STR_DIGITS smaller than threshold."
47+
#endif
48+
1449
// Don't call this function but _PyLong_GetZero() and _PyLong_GetOne()
1550
static inline PyObject* __PyLong_GetSmallInt_internal(int value)
1651
{

include/patchlevel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
/*--start constants--*/
1919
#define PY_MAJOR_VERSION 3
2020
#define PY_MINOR_VERSION 10
21-
#define PY_MICRO_VERSION 6
21+
#define PY_MICRO_VERSION 7
2222
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
2323
#define PY_RELEASE_SERIAL 0
2424

2525
/* Version as a string */
26-
#define PY_VERSION "3.10.6"
26+
#define PY_VERSION "3.10.7"
2727
/*--end constants--*/
2828

2929
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.

lib/python310.lib

0 Bytes
Binary file not shown.

src/api/command_origin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ PlayerClass CommandOriginClass::getPlayer() {
4040
}
4141

4242
NBTClass CommandOriginClass::getNbt() {
43-
return make_unique<CompoundTag>(thiz->serialize());
43+
return std::make_unique<CompoundTag>(thiz->serialize());
4444
}
4545

4646
const char* CommandOriginClass::toString() { return "<CommandOrigin>"; }

src/global.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@
55

66
#define PLUGIN_PATH "./plugins/py/"
77

8-
using std::make_unique;
98
using std::pair;
109
using std::string;
1110
using std::string_view;
1211
using std::unique_ptr;
1312
using std::unordered_map;
1413
using std::vector;
1514

16-
enum GameType {
17-
Survival = 0,
18-
Creative = 1,
19-
Adventure = 2,
20-
Spectator = 6,
21-
};
22-
2315
enum class EventCode;
2416

2517
extern class Logger logger;

0 commit comments

Comments
 (0)