Skip to content

Commit 6298cd9

Browse files
committed
Making Python 3.14 debug mode happy
1 parent f1b15e7 commit 6298cd9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/inc/sys_string/impl/platforms/python_any.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,18 @@ namespace sysstr::util
451451
obj.ready = value;
452452
}
453453

454+
template <typename T, typename = int>
455+
struct HasStaticallyAllocatedMember : std::false_type { };
456+
457+
template <typename T>
458+
struct HasStaticallyAllocatedMember <T, decltype((void)T::statically_allocated, 0)> : std::true_type { };
459+
460+
template<class T>
461+
constexpr void gccIsAPieceOfShit_assignStaticallyAllocated(T & obj, int value) {
462+
if constexpr(HasStaticallyAllocatedMember<T>::value)
463+
obj.statically_allocated = value;
464+
}
465+
454466
template<class T>
455467
constexpr void gccIsAPieceOfShit_assignData(T & obj, void * data) {
456468
obj.any = data;
@@ -474,6 +486,7 @@ namespace sysstr::util
474486
gccIsAPieceOfShit_assignHash(this->_base._base); //pypy lacks hash in PyASCIIObject
475487
this->_base._base.state.kind = Kind;
476488
gccIsAPieceOfShit_assignReady(this->_base._base.state, 1);
489+
gccIsAPieceOfShit_assignStaticallyAllocated(this->_base._base.state, 1);
477490
gccIsAPieceOfShit_assignData(this->data, const_cast<void *>(chars));
478491
if constexpr (Kind == PyUnicode_1BYTE_KIND)
479492
{

0 commit comments

Comments
 (0)