Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .cspell.dict/cpython.txt
Original file line number Diff line number Diff line change
@@ -1,87 +1,184 @@
ADDOP
aftersign
argdefs
argtypes
asdl
asname
attro
augassign
badcert
badsyntax
baseinfo
basetype
boolop
BUILDSTDLIB
bxor
byteswap
cached_tsver
cadata
cafile
calldepth
callinfo
callproc
capath
carg
cellarg
cellvar
cellvars
cfield
CLASSDEREF
classdict
cmpop
codedepth
CODEUNIT
CONVFUNC
convparam
copyslot
cpucount
defaultdict
denom
dictbytype
DICTFLAG
dictoffset
distpoint
dynload
elts
eofs
evalloop
excepthandler
exceptiontable
fblock
fblocks
fdescr
ffi_argtypes
fielddesc
fieldlist
fileutils
finalbody
flowgraph
formatfloat
freevar
freevars
fromlist
getdict
getfunc
getiter
getsets
getslice
globalgetvar
HASARRAY
HASBITFIELD
HASPOINTER
HASSTRUCT
HASUNION
heaptype
HIGHRES
IFUNC
IMMUTABLETYPE
INCREF
inlinedepth
inplace
ismine
ISPOINTER
iteminfo
Itertool
keeped
kwnames
kwonlyarg
kwonlyargs
lasti
libffi
linearise
lineiterator
linetable
loadfast
localsplus
Lshift
lsprof
MAXBLOCKS
maxdepth
metavars
miscompiles
mult
multibytecodec
nameop
nconsts
newargs
newfree
NEWLOCALS
newsemlockobject
nfrees
nkwargs
nkwelts
Nondescriptor
noninteger
nops
noraise
nseen
NSIGNALS
numer
opname
opnames
orelse
outparam
outparm
paramfunc
parg
pathconfig
patma
peepholer
phcount
platstdlib
posonlyarg
posonlyargs
prec
preinitialized
pybuilddir
pycore
pydecimal
Pyfunc
pymain
pyrepl
PYTHONTRACEMALLOC
pythonw
PYTHREAD_NAME
releasebuffer
repr
resinfo
Rshift
SA_ONSTACK
scls
setdict
setfunc
SETREF
setresult
setslice
SLOTDEFINED
SOABI
SSLEOF
stackdepth
staticbase
stginfo
storefast
stringlib
structseq
subkwargs
subparams
subscr
sval
swappedbytes
templatelib
ticketer
tmptype
tok_oldval
tvars
typeobject
typeparam
Typeparam
typeparams
typeslots
unaryop
Unhandle
unparse
unparser
VARKEYWORDS
Expand Down
26 changes: 26 additions & 0 deletions .cspell.dict/python-more.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,29 @@ xmlcharrefreplace
xoptions
xopts
yieldfrom
addcompare
altzone
classmethods
ctype
ctypes
genexpressions
getargs
getopt
getweakref
getweakrefs
inittab
Inittab
interpchannels
interpqueues
markupbase
mymodule
pydatetime
pyio
pymain
setprofileallthreads
settraceallthreads
sitebuiltins
subclassing
subpatterns
sysdict
weakrefset
4 changes: 4 additions & 0 deletions .cspell.dict/rust-more.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ hexf
hexversion
idents
illumos
ilog
indexmap
insta
keccak
Expand Down Expand Up @@ -86,4 +87,7 @@ wasmer
wasmtime
widestring
winapi
winresource
winsock
bitvec
Bitvec
4 changes: 4 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@
"GetSet",
"groupref",
"internable",
"interps",
"jitted",
"jitting",
"lossily",
"makeunicodedata",
"microbenchmark",
"microbenchmarks",
"miri",
"notrace",
"oparg",
Expand Down Expand Up @@ -121,6 +124,7 @@
"uninit",
"unraisable",
"unresizable",
"varint",
"wasi",
"zelf",
// unix
Expand Down
3 changes: 0 additions & 3 deletions Lib/test/test_peepholer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,6 @@ def f():
self.assertInBytecode(f, 'LOAD_FAST_CHECK', "a73")
self.assertInBytecode(f, 'LOAD_FAST_BORROW', "a73")

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_setting_lineno_no_undefined(self):
code = textwrap.dedent("""\
def f():
Expand Down Expand Up @@ -1123,7 +1122,6 @@ def f():
self.assertNotInBytecode(f, "LOAD_FAST_CHECK")
return f

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_modifying_local_does_not_add_check(self):
f = self.make_function_with_no_checks()
def trace(frame, event, arg):
Expand All @@ -1137,7 +1135,6 @@ def trace(frame, event, arg):
self.assertInBytecode(f, "LOAD_FAST_BORROW")
self.assertNotInBytecode(f, "LOAD_FAST_CHECK")

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_initializing_local_does_not_add_check(self):
f = self.make_function_with_no_checks()
def trace(frame, event, arg):
Expand Down
8 changes: 7 additions & 1 deletion crates/codegen/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2048,8 +2048,14 @@ impl Compiler {

let op = match usage {
NameUsage::Load => {
// Special case for class scope
// ClassBlock (not inlined comp): LOAD_LOCALS first, then LOAD_FROM_DICT_OR_DEREF
if self.ctx.in_class && !self.ctx.in_func() {
emit!(self, Instruction::LoadLocals);
Instruction::LoadFromDictOrDeref
// can_see_class_scope: LOAD_DEREF(__classdict__) first
} else if can_see_class_scope {
let classdict_idx = self.get_free_var_index("__classdict__")?;
self.emit_arg(classdict_idx, Instruction::LoadDeref);
Instruction::LoadFromDictOrDeref
} else {
Instruction::LoadDeref
Expand Down
Loading
Loading