For String Refs, inherit the type of the reffed string object.
This commit is contained in:
@@ -3356,7 +3356,6 @@ bool print_docstring(PycRef<PycObject> obj, int indent, PycModule* mod)
|
||||
case PycObject::TYPE_UNICODE:
|
||||
prefix = mod->strIsUnicode() ? 0 : 'u';
|
||||
break;
|
||||
case PycObject::TYPE_STRINGREF:
|
||||
case PycObject::TYPE_INTERNED:
|
||||
case PycObject::TYPE_ASCII:
|
||||
case PycObject::TYPE_ASCII_INTERNED:
|
||||
|
@@ -173,7 +173,6 @@ void print_const(PycRef<PycObject> obj, PycModule* mod, const char* parent_f_str
|
||||
OutputString(obj.cast<PycString>(), mod->strIsUnicode() ? 0 : 'u',
|
||||
false, pyc_output, parent_f_string_quote);
|
||||
break;
|
||||
case PycObject::TYPE_STRINGREF:
|
||||
case PycObject::TYPE_INTERNED:
|
||||
case PycObject::TYPE_ASCII:
|
||||
case PycObject::TYPE_ASCII_INTERNED:
|
||||
|
@@ -143,6 +143,8 @@ public:
|
||||
|
||||
private:
|
||||
int m_refs;
|
||||
|
||||
protected:
|
||||
int m_type;
|
||||
|
||||
public:
|
||||
|
@@ -19,10 +19,8 @@ void PycString::load(PycData* stream, PycModule* mod)
|
||||
{
|
||||
if (type() == TYPE_STRINGREF) {
|
||||
PycRef<PycString> str = mod->getIntern(stream->get32());
|
||||
m_value.resize(str->length());
|
||||
|
||||
if (str->length())
|
||||
std::char_traits<char>::copy(&m_value.front(), str->value(), str->length());
|
||||
m_type = str->m_type;
|
||||
m_value = str->m_value;
|
||||
} else {
|
||||
int length;
|
||||
if (type() == TYPE_SHORT_ASCII || type() == TYPE_SHORT_ASCII_INTERNED)
|
||||
|
@@ -140,7 +140,6 @@ void output_object(PycRef<PycObject> obj, PycModule* mod, int indent)
|
||||
OutputString(obj.cast<PycString>(), mod->strIsUnicode() ? 0 : 'u');
|
||||
fputs("\n", pyc_output);
|
||||
break;
|
||||
case PycObject::TYPE_STRINGREF:
|
||||
case PycObject::TYPE_INTERNED:
|
||||
case PycObject::TYPE_ASCII:
|
||||
case PycObject::TYPE_ASCII_INTERNED:
|
||||
|
Reference in New Issue
Block a user