mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Changed hex() and oct() again, to never emit a '-' sign.
This commit is contained in:
parent
fde462e173
commit
ebee0256f3
1 changed files with 2 additions and 7 deletions
|
@ -725,10 +725,8 @@ int_oct(v)
|
|||
long x = v -> ob_ival;
|
||||
if (x == 0)
|
||||
strcpy(buf, "0");
|
||||
else if (-x < 0)
|
||||
sprintf(buf, "0%lo", x);
|
||||
else
|
||||
sprintf(buf, "-0%lo", -x);
|
||||
sprintf(buf, "0%lo", x);
|
||||
return newstringobject(buf);
|
||||
}
|
||||
|
||||
|
@ -738,10 +736,7 @@ int_hex(v)
|
|||
{
|
||||
char buf[20];
|
||||
long x = v -> ob_ival;
|
||||
if (-x <= 0)
|
||||
sprintf(buf, "0x%lx", x);
|
||||
else
|
||||
sprintf(buf, "-0x%lx", -x);
|
||||
sprintf(buf, "0x%lx", x);
|
||||
return newstringobject(buf);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue