Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bpo-36779: time.tzname returns empty string on Windows if default cod… #13073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 12, 2019

Conversation

paulmon
Copy link
Contributor

@paulmon paulmon commented May 3, 2019

Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].

This causes time.tzname to be an empty string.
I have reported the bug to the UCRT team and will follow up, but it will take some time get a fix into production.

In the meantime one possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7

@zooba

https://bugs.python.org/issue36779

@paulmon
Copy link
Contributor Author

paulmon commented May 22, 2019

This workaround enables time.tzname to work on Windows ARM32.
Alternatively we could skip the test and leave time.tzname broken on Windows ARM32.
The CRT error which causes the empty string has been fixed in ucrtbase.dll but will likely take months to be published.

@matrixise matrixise changed the title bpo-36799: time.tzname returns empty string on Windows if default cod… bpo-36779: time.tzname returns empty string on Windows if default cod… May 22, 2019
@matrixise
Copy link
Member

Hi @paulmon I have edited the PR because that was the wrong BPO issue. Also, I have added this PR to the right bpo issue and removed it from the other one.

@paulmon
Copy link
Contributor Author

paulmon commented May 22, 2019

Thank you!

@zooba
Copy link
Member

zooba commented May 22, 2019

Definitely needs the tabs converted to spaces, and I wonder if there's a better (Windows-specific) way to get this value without changing the locale? If we're going to have an ifdef, we may as well use the proper APIs, provided the values come back the same (I have no idea what values to expect here).

@pganssle may also have an opinion. Or perhaps not :)

@paulmon
Copy link
Contributor Author

paulmon commented May 22, 2019

I'll try to get the timezone name without changing the locale.
And I'll fix the tabs of course.

@pganssle
Copy link
Member

Regardless of the resolution, I think this needs a test.

What is this supposed to return on Windows? What does it return with the workaround?

I think you can definitely get the time zone and alt zone names without changing the locale. One way to get it is from the registry, which is how we do it in tzwinlocal. I think this returns things like "Eastern Standard Time" and "Eastern Daylight Time" rather than "EST"/"EDT".

There may be a more convenient way as well.

@paulmon
Copy link
Contributor Author

paulmon commented May 23, 2019

This is the fix for a failing test. It's supposed to return 'UTC-08:00' and it returns an empty string.

FAIL: test_strptime (test.datetimetester.TestSubclassDateTime_Fast)

Traceback (most recent call last):
File "C:\python\lib\test\datetimetester.py", line 2523, in test_strptime
self.assertEqual(dt.tzname(), tzname)
AssertionError: 'UTC-08:00' != ''

@pganssle
Copy link
Member

Traceback (most recent call last):
File "C:\python\lib\test\datetimetester.py", line 2523, in test_strptime
self.assertEqual(dt.tzname(), tzname)
AssertionError: 'UTC-08:00' != ''

This is very confusing to me. This is the relevant test, and it seems like what it's doing is creating three strings: "+0000 UTC", "-0000 GMT" and a locale-specific one. If time.tzname returns an empty string, I would expect this line to raise an Exception, since the locale-specific string would be something like "-0800 ", which doesn't match %z %Z.

You can see what it's testing by running this script:

import time
from datetime import datetime

for tzseconds, tzname in ((0, 'UTC'), (0, 'GMT'),
                         (-time.timezone, time.tzname[0])):
    print("-----")
    print(f"tzseconds: {tzseconds}; tzname: {tzname}")
    if tzseconds < 0:
        sign = '-'
        seconds = -tzseconds
    else:
        sign ='+'
        seconds = tzseconds
    hours, minutes = divmod(seconds//60, 60)
    dtstr = "{}{:02d}{:02d} {}".format(sign, hours, minutes, tzname)
    print(dtstr)

On my system, this returns:

-----
tzseconds: 0; tzname: UTC
+0000 UTC
-----
tzseconds: 0; tzname: GMT
+0000 GMT
-----
tzseconds: -18000; tzname: EST
-0500 EST

I am not sure where UTC-0800 is coming from. Can you run my script on your system so we can see what's going on?

@paulmon
Copy link
Contributor Author

paulmon commented May 23, 2019

On Windows IoT Core

-----
tzseconds: 0; tzname: UTC
+0000 UTC
-----
tzseconds: 0; tzname: GMT
+0000 GMT
-----
tzseconds: -28800; tzname:
-0800

on my dev machine (Windows 10 Enterprise)

-----
tzseconds: 0; tzname: UTC
+0000 UTC
-----
tzseconds: 0; tzname: GMT
+0000 GMT
-----
tzseconds: -28800; tzname: Pacific Standard Time
-0800 Pacific Standard Time

@paulmon
Copy link
Contributor Author

paulmon commented May 23, 2019

UTC-0800 is my local time zone

import time
time.tzname

This returns ('Pacific Standard Time', 'Pacific Daylight Time') on desktop windows
On Windows IoT Core it returns ('', '')

I tracked this this down to a bug in tzset() that sets _tzname[0] and _tzname[1] to empty strings when the default ANSI code page is set to CP_UTF8, or CP_UTF7. For more on the default ANSI code page see , see GetACP( )

The default ANSI code page on most Windows installs is not CP_UTF7, or CP_UTF8. On my dev machine for example it is 1252 (Code Page Identifiers).

On Windows IoT Core the default ANSI code page is 65001 or CP_UTF8.

So in line 2511 of datetimetester.py _time.tzname[0] is empty causing the test to fail.

        for tzseconds, tzname in ((0, 'UTC'), (0, 'GMT'),
                                 (-_time.timezone, _time.tzname[0])):

Another way to check what the default ANSI codepage on your system is to run this command

reg query hklm\system\currentcontrolset\control\nls\codepage /v ACP`

@paulmon
Copy link
Contributor Author

paulmon commented May 23, 2019

I would expect this line to raise an Exception

I think it doesn't raise an exception because it's valid to use "" as parameter to a format string.

@pganssle
Copy link
Member

This returns ('Pacific Standard Time', 'Pacific Daylight Time') on desktop windows
On Windows IoT Core it returns ('', '')

This is what I expected, but I don't understand why the test was working in the first place, on Linux:

>>> datetime.strptime("-0800 ", '%z %Z')
...
ValueError: time data '-0800 ' does not match format '%z %Z'

>>> datetime.strptime("-0800 Pacific Standard Time", "%z %Z")
...
ValueError: time data '-0800 Pacific Standard Time' does not match format '%z %Z'

Is allowing empty format specifiers a Windows-specific thing?

@paulmon If the two commands above don't fail for you, what do they return? What is .tzname() on the datetimes they return?

@paulmon paulmon closed this May 23, 2019
@paulmon paulmon reopened this May 23, 2019
@paulmon
Copy link
Contributor Author

paulmon commented May 23, 2019

Closing and re-opening to force azure pipelines to run again.
Not sure why it failed. It looked like the MacOS tests were cancelled for some reason.

@paulmon
Copy link
Contributor Author

paulmon commented May 24, 2019

If the two commands above don't fail for you, what do they return? What is .tzname() on the datetimes they return?

There seems to be a connection between the value of time.tzname and the results of those two commands.

Without the current GetTimeZoneInformation fix

>>> time.tzname
('', '')
>>> datetime.strptime("-0800 ", "%z %Z")
datetime.datetime(1900, 1, 1, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=57600)))
>>> datetime.strptime("-0800 ", "%z %Z").tzname()
'UTC-08:00'
>>> datetime.strptime("-0800 Pacific Standard Time", "%z %Z")
...
ValueError: unconverted data remains: Pacific Standard Time

With the GetTimeZoneInformation fix

>>> time.tzname
('Pacific Standard Time', 'Pacific Daylight Time')
>>> datetime.strptime("-0800 ", "%z %Z")
...
ValueError: time data '-0800 ' does not match format '%z %Z'
>>> datetime.strptime("-0800 Pacific Standard Time", "%z %Z")
datetime.datetime(1900, 1, 1, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=57600), 'Pacific Standard Time'))
>>> datetime.strptime("-0800 Pacific Standard Time", "%z %Z").tzname()
'Pacific Standard Time'

@paulmon
Copy link
Contributor Author

paulmon commented May 29, 2019

The PR has been updated so that it doesn't change locale.
Does it look good, or do you think it needs more changes?
Thanks!

@zooba @pganssle

@zooba
Copy link
Member

zooba commented Jun 11, 2019

@paulmon I think this one deserves a NEWS item - could you add it?

Paul Monson and others added 2 commits June 11, 2019 15:43
@miss-islington
Copy link
Contributor

@paulmon: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit b4c7def into python:master Jun 12, 2019
@miss-islington
Copy link
Contributor

Thanks @paulmon for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-14032 is a backport of this pull request to the 3.8 branch.

vstinner pushed a commit that referenced this pull request Jun 13, 2019
GH-13073) (GH-14032)

Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].

This causes time.tzname to be an empty string.
I have reported the bug to the UCRT team and will follow up, but it will take some time get a fix into production.

In the meantime one possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7

@zooba

https://bugs.python.org/issue36779
(cherry picked from commit b4c7def)

Co-authored-by: Paul Monson <[email protected]>
@miss-islington
Copy link
Contributor

Thanks @paulmon for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 13, 2019
pythonGH-13073)

Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].

This causes time.tzname to be an empty string.
I have reported the bug to the UCRT team and will follow up, but it will take some time get a fix into production.

In the meantime one possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7

@zooba

https://bugs.python.org/issue36779
(cherry picked from commit b4c7def)

Co-authored-by: Paul Monson <[email protected]>
@bedevere-bot
Copy link

GH-14057 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Jun 13, 2019
GH-13073)

Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].

This causes time.tzname to be an empty string.
I have reported the bug to the UCRT team and will follow up, but it will take some time get a fix into production.

In the meantime one possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7

@zooba

https://bugs.python.org/issue36779
(cherry picked from commit b4c7def)

Co-authored-by: Paul Monson <[email protected]>
@pganssle
Copy link
Member

pganssle commented Jun 16, 2019

@paulmon Hey sorry I never followed up on this - this is belated, but for the record I agree with this change. Thank you for for doing this - particularly because I learned something new about how strptime works (I didn't realize that it checks tzname if available, though it makes a lot of sense).

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Debian root 3.8 has failed when building commit 0a9baec.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/211/builds/47) and take a look at the build logs.
  4. Check if the failure is related to this commit (0a9baec) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/211/builds/47

Click to see traceback logs
Reset branch '3.8'

libpython3.8d.a(bytesobject.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(exceptions.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(floatobject.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: more undefined references to `_PyTraceMalloc_NewReference' follow
libpython3.8d.a(object.o): In function `_PyObject_AssertFailed':
/root/buildarea/3.8.angelico-debian-amd64/build/Objects/object.c:2190: undefined reference to `_PyMem_DumpTraceback'
libpython3.8d.a(object.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(obmalloc.o): In function `_PyObject_DebugDumpAddress':
/root/buildarea/3.8.angelico-debian-amd64/build/Objects/obmalloc.c:2507: undefined reference to `_PyMem_DumpTraceback'
libpython3.8d.a(sliceobject.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(tupleobject.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(typeobject.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(unicodeobject.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: more undefined references to `_PyTraceMalloc_NewReference' follow
libpython3.8d.a(import.o): In function `find_frozen':
/root/buildarea/3.8.angelico-debian-amd64/build/Python/import.c:1268: undefined reference to `PyImport_FrozenModules'
libpython3.8d.a(marshal.o): In function `w_init_refs':
/root/buildarea/3.8.angelico-debian-amd64/build/Python/marshal.c:572: undefined reference to `_Py_hashtable_compare_direct'
/root/buildarea/3.8.angelico-debian-amd64/build/Python/marshal.c:572: undefined reference to `_Py_hashtable_hash_ptr'
/root/buildarea/3.8.angelico-debian-amd64/build/Python/marshal.c:572: undefined reference to `_Py_hashtable_new'
libpython3.8d.a(marshal.o): In function `w_clear_refs':
/root/buildarea/3.8.angelico-debian-amd64/build/Python/marshal.c:598: undefined reference to `_Py_hashtable_foreach'
/root/buildarea/3.8.angelico-debian-amd64/build/Python/marshal.c:599: undefined reference to `_Py_hashtable_destroy'
libpython3.8d.a(marshal.o): In function `w_ref':
/root/buildarea/3.8.angelico-debian-amd64/build/Python/marshal.c:308: undefined reference to `_Py_hashtable_get_entry'
/root/buildarea/3.8.angelico-debian-amd64/build/Python/marshal.c:326: undefined reference to `_Py_hashtable_set'
libpython3.8d.a(pylifecycle.o): In function `fatal_error':
/root/buildarea/3.8.angelico-debian-amd64/build/Python/pylifecycle.c:2123: undefined reference to `_PyFaulthandler_Fini'
libpython3.8d.a(pylifecycle.o): In function `Py_FinalizeEx':
/root/buildarea/3.8.angelico-debian-amd64/build/Python/pylifecycle.c:1257: undefined reference to `_PyTraceMalloc_Fini'
/root/buildarea/3.8.angelico-debian-amd64/build/Python/pylifecycle.c:1266: undefined reference to `_PyFaulthandler_Fini'
libpython3.8d.a(pylifecycle.o): In function `pyinit_main':
/root/buildarea/3.8.angelico-debian-amd64/build/Python/pylifecycle.c:932: undefined reference to `_PyFaulthandler_Init'
/root/buildarea/3.8.angelico-debian-amd64/build/Python/pylifecycle.c:949: undefined reference to `_PyTraceMalloc_Init'
libpython3.8d.a(config.o):(.data+0x128): undefined reference to `PyInit_faulthandler'
libpython3.8d.a(config.o):(.data+0x138): undefined reference to `PyInit__tracemalloc'
libpython3.8d.a(config.o):(.data+0x148): undefined reference to `PyInit__symtable'
libpython3.8d.a(config.o):(.data+0x158): undefined reference to `PyInit_xxsubtype'
libpython3.8d.a(gcmodule.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(_iomodule.o): In function `_io_open_impl':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:386: undefined reference to `PyFileIO_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:452: undefined reference to `PyBufferedRandom_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:454: undefined reference to `PyBufferedWriter_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:456: undefined reference to `PyBufferedReader_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:478: undefined reference to `PyTextIOWrapper_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:713: undefined reference to `PyBufferedIOBase_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyBufferedIOBase_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:713: undefined reference to `PyBufferedIOBase_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_DECREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBufferedIOBase_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBufferedIOBase_Type'
libpython3.8d.a(_iomodule.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:473: more undefined references to `PyBufferedIOBase_Type' follow
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:714: undefined reference to `PyTextIOBase_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyTextIOBase_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:714: undefined reference to `PyTextIOBase_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_DECREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyTextIOBase_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyTextIOBase_Type'
libpython3.8d.a(_iomodule.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:473: more undefined references to `PyTextIOBase_Type' follow
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:718: undefined reference to `PyFileIO_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:719: undefined reference to `PyFileIO_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyFileIO_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:719: undefined reference to `PyFileIO_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_DECREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyFileIO_Type'
libpython3.8d.a(_iomodule.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: more undefined references to `PyFileIO_Type' follow
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:722: undefined reference to `PyBytesIO_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:722: undefined reference to `PyBufferedIOBase_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:723: undefined reference to `PyBytesIO_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyBytesIO_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:723: undefined reference to `PyBytesIO_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_DECREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBytesIO_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBytesIO_Type'
libpython3.8d.a(_iomodule.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:473: more undefined references to `PyBytesIO_Type' follow
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:724: undefined reference to `_PyBytesIOBuffer_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:728: undefined reference to `PyStringIO_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:728: undefined reference to `PyTextIOBase_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:729: undefined reference to `PyStringIO_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyStringIO_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:729: undefined reference to `PyStringIO_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_DECREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyStringIO_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyStringIO_Type'
libpython3.8d.a(_iomodule.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:473: more undefined references to `PyStringIO_Type' follow
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:738: undefined reference to `PyBufferedReader_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:738: undefined reference to `PyBufferedIOBase_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:739: undefined reference to `PyBufferedReader_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyBufferedReader_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:739: undefined reference to `PyBufferedReader_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_DECREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBufferedReader_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBufferedReader_Type'
libpython3.8d.a(_iomodule.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:473: more undefined references to `PyBufferedReader_Type' follow
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:742: undefined reference to `PyBufferedWriter_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:742: undefined reference to `PyBufferedIOBase_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:743: undefined reference to `PyBufferedWriter_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyBufferedWriter_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:743: undefined reference to `PyBufferedWriter_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_DECREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBufferedWriter_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBufferedWriter_Type'
libpython3.8d.a(_iomodule.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:473: more undefined references to `PyBufferedWriter_Type' follow
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:746: undefined reference to `PyBufferedRWPair_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:746: undefined reference to `PyBufferedIOBase_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:747: undefined reference to `PyBufferedRWPair_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyBufferedRWPair_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:747: undefined reference to `PyBufferedRWPair_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_DECREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBufferedRWPair_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBufferedRWPair_Type'
libpython3.8d.a(_iomodule.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:473: more undefined references to `PyBufferedRWPair_Type' follow
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:750: undefined reference to `PyBufferedRandom_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:750: undefined reference to `PyBufferedIOBase_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:751: undefined reference to `PyBufferedRandom_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyBufferedRandom_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:751: undefined reference to `PyBufferedRandom_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_DECREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBufferedRandom_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyBufferedRandom_Type'
libpython3.8d.a(_iomodule.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:473: more undefined references to `PyBufferedRandom_Type' follow
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:754: undefined reference to `PyTextIOWrapper_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:754: undefined reference to `PyTextIOBase_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:755: undefined reference to `PyTextIOWrapper_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyTextIOWrapper_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:755: undefined reference to `PyTextIOWrapper_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_DECREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyTextIOWrapper_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:470: undefined reference to `PyTextIOWrapper_Type'
libpython3.8d.a(_iomodule.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:473: more undefined references to `PyTextIOWrapper_Type' follow
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:758: undefined reference to `PyIncrementalNewlineDecoder_Type'
libpython3.8d.a(_iomodule.o): In function `_Py_INCREF':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:459: undefined reference to `PyIncrementalNewlineDecoder_Type'
libpython3.8d.a(_iomodule.o): In function `PyInit__io':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:758: undefined reference to `PyIncrementalNewlineDecoder_Type'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/_iomodule.c:758: undefined reference to `PyIncrementalNewlineDecoder_Type'
libpython3.8d.a(iobase.o): In function `_io__RawIOBase_readall_impl':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/iobase.c:975: undefined reference to `_PyIO_trap_eintr'
libpython3.8d.a(iobase.o): In function `_io__IOBase_writelines':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/iobase.c:788: undefined reference to `_PyIO_trap_eintr'
libpython3.8d.a(iobase.o): In function `_io__IOBase_readline_impl':
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/iobase.c:564: undefined reference to `_PyIO_trap_eintr'
/root/buildarea/3.8.angelico-debian-amd64/build/./Modules/_io/iobase.c:604: undefined reference to `_PyIO_trap_eintr'
libpython3.8d.a(classobject.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(complexobject.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(genobject.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(context.o): In function `_Py_NewReference':
/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: undefined reference to `_PyTraceMalloc_NewReference'
libpython3.8d.a(context.o):/root/buildarea/3.8.angelico-debian-amd64/build/./Include/object.h:439: more undefined references to `_PyTraceMalloc_NewReference' follow
collect2: error: ld returned 1 exit status
make: *** [python] Error 1

@vstinner
Copy link
Member

@paulmon
Copy link
Contributor Author

paulmon commented Jun 17, 2019

https://buildbot.python.org/all/#builders/211/builds/47

I reported this bug as: https://bugs.python.org/issue37314

It looks like a different commit caused this buildbot failure. The only file changed in this commit is timemodule.c, and the build failures are all in _iomodule.c

@vstinner
Copy link
Member

Welcome to the exciting universe of buildbots!

@paulmon paulmon deleted the time_tzname branch June 19, 2019 21:29
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
pythonGH-13073)

Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].

This causes time.tzname to be an empty string.
I have reported the bug to the UCRT team and will follow up, but it will take some time get a fix into production.

In the meantime one possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7

@zooba 


https://bugs.python.org/issue36779
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
pythonGH-13073)

Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].

This causes time.tzname to be an empty string.
I have reported the bug to the UCRT team and will follow up, but it will take some time get a fix into production.

In the meantime one possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7

@zooba 


https://bugs.python.org/issue36779
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants