Re: [issue21570] String being confused with datetime.datetime object.

2014-05-24 Thread M.-A. Lemburg
On 24.05.2014 15:55, Brandon wrote: Observe the following code: import MySQLdb, MySQLdb.cursors, datetime ... mysqlCursor is a cursor object from a connection to database from the MySQLdb module ... mysqlCursor.execute(SELECT NOW()) timeRow = mysqlCursor.fetchall() currentDateTime =

Re: [issue11322] encoding package's normalize_encoding() function is too slow

2014-06-15 Thread M.-A. Lemburg
On 15.06.2014 15:02, Mark Lawrence wrote: What's the status of this issue, as we've lived with this really slow implementation for well over three years? I guess it just needs someone to write a patch. Note that encoding lookups are cached, so the slowness only becomes an issue if you

Re: [issue21772] platform.uname() not EINTR safe

2014-07-08 Thread M.-A. Lemburg
On 08.07.2014 11:40, Stefano Borini wrote: You can't use subprocess. platform is used during build. subprocess needs select, but select is a compiled module and at that specific time in the build process is not compiled yet. Good point :-) -- Marc-Andre Lemburg eGenix.com

Re: [issue22980] C extension naming doesn't take bitness into account

2014-12-16 Thread M.-A. Lemburg
On 16.12.2014 21:28, Steve Dower wrote: Steve Dower added the comment: get_platform() will be difficult to reuse, for bootstrapping reasons ISTM that if you can't determine the value at compile time, then it doesn't matter to compilation enough to need to appear in the tag. Antoine has

Re: [issue13881] Stream encoder for zlib_codec doesn't use the incremental encoder

2015-01-15 Thread M.-A. Lemburg
On 15.01.2015 05:43, Martin Panter wrote: New patch that also fixes StreamWriter.writelines() in general for the byte codecs Could you explain this new undocumented class ? +class _IncrementalBasedWriter(StreamWriter): +Generic StreamWriter implementation. + +The _EncoderClass

Re: [issue14014] codecs.StreamWriter.reset contract not fulfilled

2015-01-14 Thread M.-A. Lemburg
Adding a note to the documentation is fine. The .reset() method doesn't have anything to do with the underlying stream. It's only meant to work at the codec level and needed for codecs that keep internal state. -- Marc-Andre Lemburg eGenix.com ___

Re: [issue23857] Make default HTTPS certificate verification setting configurable via global ini file

2015-04-05 Thread M.-A. Lemburg
On 05.04.2015 22:49, Donald Stufft wrote: Donald Stufft added the comment: I don't consider monkey patching a proper way to configure a Python installation. The point is that that TLS validation on/off isn't conceptually a Python level configuration option, that's going to be a per

Re: [issue23857] Make default HTTPS certificate verification setting configurable via global ini file

2015-04-05 Thread M.-A. Lemburg
FWIW: I just ran into a situation where the new approach resulted in pip, setuptools and zc.buildout not working anymore. This was on an AIX system which did come with CA root certificates at all. Now, I knew how to fix this, but the solution was not an obvious one. I had to use truss to figure

Re: [issue24872] Add /NODEFAULTLIB:MSVCRT to _msvccompiler

2015-08-17 Thread M.-A. Lemburg
On 15.08.2015 22:41, Steve Dower wrote: Marc-Andre: there are a few concerns with including DLLs that aren't new with any of the 3.5 changes. * depending on another CRT version is fine *if* it is available (users may have to be told/helped to install the redistributable themselves) *

Re: [issue24534] disable executing code in .pth files

2015-06-30 Thread M.-A. Lemburg
On 01.07.2015 00:16, Min RK wrote: Just because a feature can be misused doesn't make it a bad feature. That's fair. I'm just not aware of any uses of this feature that aren't misuses, hence the patch. I don't remember the details of why this feature was added, but can imagine that it was

Re: [issue22798] time.mktime doesn't update time.tzname

2015-09-29 Thread M.-A. Lemburg
On 29.09.2015 11:31, Akira Li wrote: > > Akira Li added the comment: > >> Would issue22798.diff patch address your issue? > > No. The issue is that C mktime() may update C tzname on some platforms > but time.mktime() does not update time.tzname on these platforms while > the time module docs

Re: [issue26839] Python 3.5 running on Linux kernel 3.17+ can block at startup or on importing the random module on getrandom()

2016-06-07 Thread M.-A. Lemburg
On 07.06.2016 22:27, Theodore Tso wrote: > > Secondly, when I decided to add this behavior to getrandom(2), it was because > people were really worried that people would be using /dev/urandom for > security-critical things (e.g., initializing ssh host session keys, when > they'd _really_

Re: [issue21955] ceval.c: implement fast path for integers with a single digit

2016-02-05 Thread M.-A. Lemburg
On 05.02.2016 16:14, STINNER Victor wrote: > > Please don't. I would like to have time to benchmark all these patches (there > are now 9 patches attached to the issue :-)) and I would like to hear > Serhiy's feedback on your latest patches. Regardless of the performance, the fastint5.patch

Re: [issue21955] ceval.c: implement fast path for integers with a single digit

2016-02-03 Thread M.-A. Lemburg
On 03.02.2016 18:05, STINNER Victor wrote: > >> python -m timeit "sum([x * x * 1 for x in range(100)])" > > If you only want to benchmark x*y, x+y and list-comprehension, you > should use a tuple for the iterator. ... and precalculate that in the setup: python -m timeit -s

Re: [issue29410] Moving to SipHash-1-3

2017-02-01 Thread M.-A. Lemburg
On 01.02.2017 10:14, Christian Heimes wrote: > > PEP 456 defines an API to add more hashing algorithms and make the selection > of hash algorithm a compile time option. We can easily add SipHash-1-3 and > make it the default algorithm. Vendors then can select between FNV2, > SipHash-1-3 and

Re: [issue29585] site.py imports relatively large `sysconfig` module.

2017-02-17 Thread M.-A. Lemburg
On 17.02.2017 13:06, STINNER Victor wrote: >> Alternatively, sysconfig data could be made available via a C lookup >> function; with the complete dictionary only being created on demand. >> get_config_var() already is such a lookup API which could be used as >> front-end. > > I don't think

Re: [issue15369] pybench and test.pystone poorly documented

2016-09-15 Thread M.-A. Lemburg
On 15.09.2016 11:11, STINNER Victor wrote: > > STINNER Victor added the comment: > > Hum, since the discussion restarted, I reopen the issue ... > > "Well, pybench is not just one benchmark, it's a whole collection of > benchmarks for various different aspects of the CPython VM and per concept

Re: [issue31530] [2.7] Python 2.7 readahead feature of file objects is not thread safe

2017-09-20 Thread M.-A. Lemburg
Why not simply document the fact that read ahead in Python 2.7 is not thread-safe and leave it at that ? .next() and .readline() already don't work well together, so this would just add one more case. -- Marc-Andre Lemburg eGenix.com ___

Re: [issue31744] Python 2.7.14 Fails to compile on CentOS/RHEL7

2017-10-10 Thread M.-A. Lemburg
I'm not sure whether this is related, but your quoting for --rpath doesn't appear to work: On 10.10.2017 14:17, Brian Sidebotham wrote: > LDFLAGS='-Wl,-rpath=$\\$$ORIGIN/../lib' \ > ... > gcc -pthread -Wl,-rpath=RIGIN/../lib -fprofile-generate -Xlinker > -export-dynamic -o python \ >

Re: [issue32110] Make codecs.StreamReader.read() more compatible with read() of other files

2017-11-22 Thread M.-A. Lemburg
On 22.11.2017 08:40, Serhiy Storchaka wrote: > Usually the read() method of a file-like object takes one optional argument > which limits the amount of data (the number of bytes or characters) returned > if specified. > > codecs.StreamReader.read() also has such parameter. But this is the

Re: [issue32429] Outdated Modules/Setup warning is invisible

2017-12-27 Thread M.-A. Lemburg
On 27.12.2017 00:24, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > >> +1 - do you have any thoughts on that? > > I think the current scheme may have been useful at a time where DVCS didn't > exist. You would maintain an unversioned copy of Modules/Setup.dist

Re: [issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-23 Thread M.-A. Lemburg
Just found an internal API which already takes care of unregistering a search function: _PyCodec_Forget(). All that needs to be done is to expose this as codecs.unregister() and add the clearing of the lookup cache. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from

Re: [issue41842] Add codecs.unregister() to unregister a codec search function

2020-09-23 Thread M.-A. Lemburg
On 23.09.2020 14:56, STINNER Victor wrote: > Marc-Andre Lemburg explained: > > "There is no API to unregister a codec search function, since deregistration > would break the codec cache used by the registry to speedup codec > lookup." > > One simple solution would be to clear the cache >

Re: [issue28468] Add platform.freedesktop_os_release()

2020-11-25 Thread M.-A. Lemburg
On 25.11.2020 11:13, STINNER Victor wrote: > Platform was always a thin wrapper to OS functions. For example, there is no > unified API to retrieve OS name and version on Windows, macOS or Linux. You > need to pick the proper function. For me, freedesktop_os_release() just > follows this trend.

Re: [issue42967] Web cache poisoning - `;` as a query args separator

2021-01-20 Thread M.-A. Lemburg
On 20.01.2021 12:07, STINNER Victor wrote: > Maybe we should even go further in Python 3.10 and only split at "&" by > default, but let the caller to opt-in for ";" separator as well. +1. Personally, I've never seen URLs encoded with ";" as query parameter separator in practice on the server

Re: [issue43976] Allow Python distributors to add custom site install schemes

2021-05-04 Thread M.-A. Lemburg
On 04.05.2021 22:07, Steve Dower wrote: > > Perhaps what I'm suggesting here is that I don't see any reason for "sudo pip > install ..." into a distro-installed Python to ever need to work, and would > be quite happy for it to just fail miserably every time (which is already the > case for the

Re: [issue43510] PEP 597: Implemente encoding="locale" option and EncodingWarning

2021-03-31 Thread M.-A. Lemburg
On 31.03.2021 11:30, STINNER Victor wrote: > > To me, it sounds really weird to accept an encoding when a file is opened in > binary mode. open(filename, "rb", encoding="locale") looks like a bug. Same here. If encoding is used as an argument and then not used, this is a bug, not a feature :-)

Re: [issue43552] Add locale.get_locale_encoding() and locale.get_current_locale_encoding()

2021-03-19 Thread M.-A. Lemburg
On 19.03.2021 14:47, STINNER Victor wrote: > > STINNER Victor added the comment: > >> - If you add "current", people will rightly ask: then what do all the >> other APIs in the locale module return ? Of course, they all return >> the current state of settings :-) So this is unnecessary as well.

Re: [issue43552] Add locale.get_locale_encoding() and locale.get_current_locale_encoding()

2021-03-19 Thread M.-A. Lemburg
On 19.03.2021 14:57, Inada Naoki wrote: > > Background: PEP 597 adds new `encoding="locale"`option to open() and > TextIOWrapper(). It is same to `encoding=None` for now, but it means using > "locale encoding" explicitly. > > But this is wrong in UTF-8 mode. Please address UTF-8 mode

Re: [issue43552] Add locale.get_locale_encoding() and locale.get_current_locale_encoding()

2021-03-19 Thread M.-A. Lemburg
On 19.03.2021 10:17, STINNER Victor wrote: > > New submission from STINNER Victor : > > I propose to add two new functions: > > * locale.get_locale_encoding(): it's exactly the same than > locale.getpreferredencoding(False). > > * locale.get_current_locale_encoding(): always get the current

Re: [issue43552] Add locale.get_locale_encoding() and locale.get_current_locale_encoding()

2021-03-19 Thread M.-A. Lemburg
On 19.03.2021 12:05, STINNER Victor wrote: > I'm not sure what to do with locale.getdefaultlocale(). Should we deprecate > it? I never used this function. How is it used? For which purpose? > > I undertand that in 2000, locale.getdefaultlocale() was interesting to avoid > calling

Re: [issue43552] Add locale.get_locale_encoding() and locale.get_current_locale_encoding()

2021-03-19 Thread M.-A. Lemburg
On 19.03.2021 12:35, Eryk Sun wrote: > > Eryk Sun added the comment: > >> Read the ANSI code page on Windows, > > I don't see why the Windows implementation is inconsistent with POSIX here. > If it were changed to be consistent, the default encoding at startup would > remain the same, since

Re: [issue43552] Add locale.get_locale_encoding() and locale.get_current_locale_encoding()

2021-03-19 Thread M.-A. Lemburg
On 19.03.2021 12:26, STINNER Victor wrote: > > STINNER Victor added the comment: > > Recently, I spent some days to document properly encodings used by Python. Thanks for documenting this. I would prefer to leave the locale module to really just an interface to the lib C locale logic and not

Re: [issue43552] Add locale.get_locale_encoding() and locale.get_current_locale_encoding()

2021-03-19 Thread M.-A. Lemburg
On 19.03.2021 11:36, STINNER Victor wrote: > > STINNER Victor added the comment: > >> locale.getencoding() >> >> which interfaces to nl_langinfo(CODESET) or the Windows code >> page and does not try to do any magic, ie. does *not* call >> setlocale(). It needs to return what the lib C currently

Re: [issue43115] locale.getlocale fails if locale is set

2021-02-17 Thread M.-A. Lemburg
On 17.02.2021 10:55, Anders Munch wrote: import locale locale.setlocale(locale.LC_ALL, 'en_DE') > 'en_DE' locale.getlocale() > Traceback (most recent call last): > File "", line 1, in > File "C:\flonidan\env\Python38-64\lib\locale.py", line 591, in getlocale > return

Re: [issue43115] locale.getlocale fails if locale is set

2021-02-18 Thread M.-A. Lemburg
On 17.02.2021 15:02, Anders Munch wrote: >> BTW: What is wxWidgets doing with the returned values ? > > wxWidgets doesn't call getlocale, it's a C++ library (wrapped by wxPython) > that uses C setlocale. > > What does use getlocale is time.strptime and datetime.datetime.strptime, so > when