Skip to content

Commit

Permalink
throw StaticTypeError instead of TypeError
Browse files Browse the repository at this point in the history
Summary: Creates a `PyExc_StaticTypeError` subclass of `PyExc_TypeError` that we throw for Static Python type guard errors.

Reviewed By: DinoV

Differential Revision: D57743572

fbshipit-source-id: 186197ba6da6991ecc29b24a34c4b25c2fc89152
  • Loading branch information
pilleye authored and facebook-github-bot committed Jun 21, 2024
1 parent a869a48 commit 46f7028
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Include/cinder/hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ CiAPI_DATA(Ci_HookType_PyJIT_GetCurrentCodeFlags)
CiAPI_DATA(int64_t) __strobe_RuntimeFrameState_py_code;
CiAPI_DATA(int64_t) __strobe_CodeRuntime_py_code;

CiAPI_DATA(PyObject*) CiExc_StaticTypeError;

#ifdef __cplusplus
} // extern "C"
#endif
2 changes: 2 additions & 0 deletions Python/cinderhooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Ci_HookType_PyJIT_GetBuiltins Ci_hook_PyJIT_GetBuiltins = NULL;
Ci_HookType_PyJIT_GetGlobals Ci_hook_PyJIT_GetGlobals = NULL;
Ci_HookType_PyJIT_GetCurrentCodeFlags Ci_hook_PyJIT_GetCurrentCodeFlags = NULL;

PyObject* CiExc_StaticTypeError = NULL;

// For backward compatibility, we need this in libpython rather than the
// CinderX module.
int _PyShadowFrame_WalkAndPopulate(
Expand Down

0 comments on commit 46f7028

Please sign in to comment.