File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -109,4 +109,22 @@ typedef struct
109109
110110} // namespace Python3_12
111111
112+ namespace Python3_14t {
113+
114+ struct _PyUnicode_State
115+ {
116+ unsigned char interned;
117+ unsigned int kind : 3 ;
118+ unsigned int compact : 1 ;
119+ unsigned int ascii : 1 ;
120+ unsigned int statically_allocated : 1 ;
121+ };
122+
123+ } // namespace Python3_14t
124+
125+ union AnyPyUnicodeState {
126+ Python3::_PyUnicode_State python3;
127+ Python3_14t::_PyUnicode_State python3_14t;
128+ };
129+
112130} // namespace pystack
Original file line number Diff line number Diff line change @@ -540,9 +540,15 @@ AbstractProcessManager::getStringFromAddress(remote_addr_t addr) const
540540 << addr;
541541 Structure<py_unicode_v> unicode (shared_from_this (), addr);
542542
543- Python3::_PyUnicode_State state = unicode.getField (&py_unicode_v::o_state);
544- if (state.kind != 1 || state.compact != 1 ) {
545- throw InvalidRemoteObject ();
543+ AnyPyUnicodeState state = unicode.getField (&py_unicode_v::o_state);
544+ if (versionIsAtLeast (3 , 14 ) and isFreeThreaded ()) {
545+ if (state.python3_14t .kind != 1 || state.python3_14t .compact != 1 ) {
546+ throw InvalidRemoteObject ();
547+ }
548+ } else {
549+ if (state.python3 .kind != 1 || state.python3 .compact != 1 ) {
550+ throw InvalidRemoteObject ();
551+ }
546552 }
547553
548554 len = unicode.getField (&py_unicode_v::o_length);
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ struct py_bytes_v
7777struct py_unicode_v
7878{
7979 ssize_t size;
80- FieldOffset<Python3::_PyUnicode_State > o_state;
80+ FieldOffset<AnyPyUnicodeState > o_state;
8181 FieldOffset<Py_ssize_t> o_length;
8282 FieldOffset<remote_addr_t > o_ascii;
8383};
You can’t perform that action at this time.
0 commit comments