Skip to content

Commit 1b787b3

Browse files
committed
Use atomics when loading oparg
1 parent 4c7a4b9 commit 1b787b3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Python/specialize.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,7 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
11271127
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_OUT_OF_VERSIONS);
11281128
return -1;
11291129
}
1130+
uint8_t oparg = FT_ATOMIC_LOAD_UINT8_RELAXED(instr->op.arg);
11301131
switch(kind) {
11311132
case OVERRIDING:
11321133
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_OVERRIDING_DESCRIPTOR);
@@ -1136,7 +1137,6 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
11361137
if (shadow) {
11371138
goto try_instance;
11381139
}
1139-
int oparg = instr->op.arg;
11401140
if (oparg & 1) {
11411141
if (specialize_attr_loadclassattr(owner, instr, name, descr,
11421142
tp_version, kind, true,
@@ -1166,7 +1166,7 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
11661166
if (!function_check_args(fget, 1, LOAD_ATTR)) {
11671167
return -1;
11681168
}
1169-
if (instr->op.arg & 1) {
1169+
if (oparg & 1) {
11701170
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_METHOD);
11711171
return -1;
11721172
}
@@ -1243,7 +1243,7 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
12431243
if (!function_check_args(descr, 2, LOAD_ATTR)) {
12441244
return -1;
12451245
}
1246-
if (instr->op.arg & 1) {
1246+
if (oparg & 1) {
12471247
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_METHOD);
12481248
return -1;
12491249
}
@@ -1280,7 +1280,7 @@ do_specialize_instance_load_attr(PyObject* owner, _Py_CODEUNIT* instr, PyObject*
12801280
if (shadow) {
12811281
goto try_instance;
12821282
}
1283-
if ((instr->op.arg & 1) == 0) {
1283+
if ((oparg & 1) == 0) {
12841284
if (specialize_attr_loadclassattr(owner, instr, name, descr,
12851285
tp_version, kind, false,
12861286
shared_keys_version)) {

0 commit comments

Comments
 (0)