gh-132775: Add _PyMarshal_GetXIData() by ericsnowcurrently · Pull Request #133108 · python/cpython · GitHub
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
7 changes: 7 additions & 0 deletions Include/internal/pycore_crossinterp.h
57 changes: 55 additions & 2 deletions Lib/test/_crossinterp_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def ham_C_closure(z):
ham_C_closure, *_ = eggs_closure_C(2)


FUNCTIONS = [
TOP_FUNCTIONS = [
# shallow
spam_minimal,
spam_full,
Expand All @@ -112,6 +112,8 @@ def ham_C_closure(z):
spam_NC,
spam_CN,
spam_CC,
]
NESTED_FUNCTIONS = [
# inner func
eggs_nested,
eggs_closure,
Expand All @@ -125,6 +127,10 @@ def ham_C_closure(z):
ham_C_nested,
ham_C_closure,
]
FUNCTIONS = [
*TOP_FUNCTIONS,
*NESTED_FUNCTIONS,
]


#######################################
Expand Down Expand Up @@ -157,8 +163,10 @@ async def asyncgen_spam(*args):
gen_spam_1,
gen_spam_2,
async_spam,
coro_spam, # actually FunctionType?
asyncgen_spam,
]
FUNCTION_LIKE_APPLIED = [
coro_spam, # actually FunctionType?
asynccoro_spam, # actually FunctionType?
]

Expand Down Expand Up @@ -202,6 +210,13 @@ def __init__(self, a, b, c):
# __str__
# ...

def __eq__(self, other):
if not isinstance(other, SpamFull):
return NotImplemented
return (self.a == other.a and
self.b == other.b and
self.c == other.c)

@property
def prop(self):
return True
Expand All @@ -222,9 +237,47 @@ class EggsNested:
EggsNested = class_eggs_inner()


TOP_CLASSES = {
Spam: (),
SpamOkay: (),
SpamFull: (1, 2, 3),
SubSpamFull: (1, 2, 3),
SubTuple: ([1, 2, 3],),
}
CLASSES_WITHOUT_EQUALITY = [
Spam,
SpamOkay,
]
BUILTIN_SUBCLASSES = [
SubTuple,
]
NESTED_CLASSES = {
EggsNested: (),
}
CLASSES = {
**TOP_CLASSES,
**NESTED_CLASSES,
}


#######################################
# exceptions

class MimimalError(Exception):
pass


class RichError(Exception):
def __init__(self, msg, value=None):
super().__init__(msg, value)
self.msg = msg
self.value = value

def __eq__(self, other):
if not isinstance(other, RichError):
return NotImplemented
if self.msg != other.msg:
return False
if self.value != other.value:
return False
return True
235 changes: 227 additions & 8 deletions Lib/test/test_crossinterp.py
Loading