[issue34542] [TLS] Update test certs to future proof settings

2018-08-29 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset e6dac0077996b1e1f886f036d6f2606237fa4c85 by Christian Heimes in 
branch 'master':
bpo-34542: Update test certs and keys (GH-8997)
https://github.com/python/cpython/commit/e6dac0077996b1e1f886f036d6f2606237fa4c85


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34542] [TLS] Update test certs to future proof settings

2018-08-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8477

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34495] excess_args asserts if args == nullptr

2018-08-29 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34540] shutil._call_external_zip should use subprocess

2018-08-29 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset d8b103b8b3ef9644805341216963a64098642435 by Benjamin Peterson in 
branch '2.7':
closes bpo-34540: Convert shutil._call_external_zip to use subprocess rather 
than distutils.spawn. (GH-8985)
https://github.com/python/cpython/commit/d8b103b8b3ef9644805341216963a64098642435


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34545] error in the repl due to indentation

2018-08-29 Thread Noah Haasis


New submission from Noah Haasis :

Pressing the tab key in the python REPL in my command line (cmder on windows 10 
32bit) causes an exception:
>>> Readline internal error 
>>>   
Traceback (most recent call last):  
  
  File 
"C:\Users\leinw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyreadline\console\console.py",
 line 768, in hook_wrapper_23   
res = ensure_str(readline_hook(prompt)) 
  
  File 
"C:\Users\leinw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyreadline\rlmain.py",
 line 571, in readline   
self._readline_from_keyboard()  
  
  File 
"C:\Users\leinw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyreadline\rlmain.py",
 line 536, in _readline_from_keyboard
if self._readline_from_keyboard_poll(): 
  
  File 
"C:\Users\leinw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyreadline\rlmain.py",
 line 556, in _readline_from_keyboard_pol
result = self.mode.process_keyevent(event.keyinfo)  
  
  File 
"C:\Users\leinw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyreadline\modes\emacs.py",
 line 243, in process_keyevent  
r = self.process_keyevent_queue[-1](keyinfo)
  
  File 
"C:\Users\leinw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyreadline\modes\emacs.py",
 line 286, in _process_keyevent 
r = dispatch_func(keyinfo)  
  
  File 
"C:\Users\leinw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyreadline\modes\basemode.py",
 line 257, in complete   
completions = self._get_completions()   
  
  File 
"C:\Users\leinw\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pyreadline\modes\basemode.py",
 line 200, in _get_completions   
r = self.completer(ensure_unicode(text), i) 
  
  File 
"C:\Users\leinw\AppData\Local\Programs\Python\Python36-32\lib\rlcompleter.py", 
line 80, in complete
readline.redisplay()
  
AttributeError: module 'readline' has no attribute 'redisplay'  


This happens even if python expects indentation.

--
components: Windows
messages: 324366
nosy: noah.haasis, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: error in the repl due to indentation
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1529353] Squeezer - squeeze large output in IDLE's shell

2018-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I partly answered questions already.

1. Yes.  Always show.  Fix delay at 80 until we decide on something better.

2. No.  Max should be enough.  I once printed over 500_000 short lines to see 
if scrolling remained responsive.  It did.  I could have set min to 1_000_000 
for that experiment.  Am I correct in presuming that only one block of output, 
between code imputs, can be squeezed?

Converting extensions to features mostly removed the option to omit features.

3. No, if not gone already.  I don't want to proliferate keyboard shortcuts, at 
least not until we get rid of some that must be nearly unused.

I want to make revising the use of keys within output blocks a separate issue.

4. Maybe  chars would be better.

'a'*1000 currently wraps to 13 80-char lines.  (This would change if we add 
horizontal scrollbar, as has been requested.)  The viewer does not wrap.  I 
think it should as there is now no way to see entire line.  Or it needs a 
scrollbar.  Viewer is modal, but does it need to be?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30618] readlink for pathlib paths

2018-08-29 Thread Berker Peksag


Berker Peksag  added the comment:

The resolve() method already solves symlinks, but I think this is a reasonable 
feature request. I've just reviewed PR 8285.

--
nosy: +berker.peksag, pitrou
versions: +Python 3.8 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34529] add the option for json.dumps to return newline delimited json

2018-08-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This format is known as JSON Lines: http://jsonlines.org/. Its support in the 
user code is trivial -- just one or two lines of code.

Writing:

for item in items:
json.dump(item, file)

or

jsondata = ''.join(json.dumps(item) for item in items)

Reading:

items = [json.loads(line) for line in file]

or

items = [json.loads(line) for line in jsondata.splitlines()]

See also issue31553 and issue34393. I think all these propositions should be 
rejected.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34528] Windows installer: Failed to run untrusted mode.

2018-08-29 Thread Steve Dower


Steve Dower  added the comment:

We're totally okay with you using a different installer if you want. We know 
and trust Anaconda, and while they do things differently, if that model works 
for you then it'll be fine.

Python 3.7 shouldn't need any registry settings or environment variables to 
operate correctly for the most part - I fixed those dependencies in 3.6. You 
may need to "python -m pip install --force pip" after copying it though, if you 
want to use the plain "pip" command ("python -m pip" will work). You also won't 
get the py.exe launcher unless you copy that from C:\Windows.

Good luck!

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34544] FreeBSD: Fatal Python error: get_locale_encoding: failed to get the locale encoding: nl_langinfo(CODESET) failed

2018-08-29 Thread STINNER Victor


New submission from STINNER Victor :

It seems like my recent work on Python initialization broke Python on FreeBSD. 
Many test_c_locale_coerce tests now fail with:

"Fatal Python error: get_locale_encoding: failed to get the locale encoding: 
nl_langinfo(CODESET) failed"

Example of failed buildbot build:

https://buildbot.python.org/all/#/builders/87/builds/1340

It seems like this buildbot started to fail at this build:

https://buildbot.python.org/all/#/builders/87/builds/1332

This build has been triggered by this change:

commit 177d921c8c03d30daa32994362023f777624b10d
Author: Victor Stinner 
Date:   Wed Aug 29 11:25:15 2018 +0200

bpo-34485, Windows: LC_CTYPE set to user preference (GH-8988)

On Windows, the LC_CTYPE is now set to the user preferred locale at
startup: _Py_SetLocaleFromEnv(LC_CTYPE) is now called during the
Python initialization. Previously, the LC_CTYPE locale was "C" at
startup, but changed when calling setlocale(LC_CTYPE, "") or
setlocale(LC_ALL, "").

pymain_read_conf() now also calls _Py_SetLocaleFromEnv(LC_CTYPE) to
behave as _Py_InitializeCore(). Moreover, it doesn't save/restore the
LC_ALL anymore.

On Windows, standard streams like sys.stdout now always use
surrogateescape error handler by default (ignore the locale).

test_c_locale_coerce tests invalid locales like LANG="invalid.ascii". It seems 
like Python supported such configuration before my changes.

My recent work:

* bpo-34523: filesystem encoding/errors
* bpo-34485: stdio encoding/errors

--
components: Interpreter Core
messages: 324361
nosy: vstinner
priority: normal
severity: normal
status: open
title: FreeBSD: Fatal Python error: get_locale_encoding: failed to get the 
locale encoding: nl_langinfo(CODESET) failed
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34529] add the option for json.dumps to return newline delimited json

2018-08-29 Thread Bob Ippolito


Bob Ippolito  added the comment:

I think the best start would be to add a bit of documentation with an example 
of how you could work with newline delimited json using the existing module 
as-is. On the encoding side you need to ensure that it's a compact 
representation without embedded newlines, e.g.:

for obj in objs:
yield json.dumps(obj, separators=(',', ':')) + '\n'

I don't think it would make sense to support this directly from dumps, as it's 
really multiple documents rather than the single document that every other form 
of dumps will output.

On the read side it would be something like:

for doc in lines:
yield json.loads(doc)

I'm not sure if this is common enough (and separable enough from I/O and error 
handling constraints) to be worth adding the functionality directly into json 
module. I think it would be more appropriate in the short to medium term that 
the each service (e.g. BigQuery) would have its own module with helper 
functions or framework that encapsulates the protocol that the particular 
service speaks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:

I dislike the idea of documentation the Windows clocks in the queue 
documentation, it's not the right place. I dislike the idea of documentating 
Windows "internals" in the Python documentation. You should see Python as a 
"thin wrapper" to the operating system. If you have an issue on a platform, you 
should look at the platform documentation. Python already provides 
time.get_clock_info('monotonic').

>From what I read, changing the system clock resolution is a bad idea, since 
>the Windows kernel is not designed for that, and it can reduce the battery 
>life.

About Windows vs Linux, as I wrote, you are looking at the wrong way. 
queue.get() is not a bottleneck if you use threads, asyncio, multiprocessing or 
whatever.

Again, this issue is not a bug. And I dislike the idea of documentating the 
behaviour. So I still consider that the issue should be closed as "not a bug". 
But I leave it open since it seems like you want to use it to discuss Windows 
clocks ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34529] add the option for json.dumps to return newline delimited json

2018-08-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> The main difference between Json and new line delimited json is that new line 
> contains valid json in each line. 

It is up to Bob to decide whether this feature request is within the scope of 
the module.

--
assignee:  -> bob.ippolito
components: +Library (Lib)
nosy: +bob.ippolito
versions: +Python 3.8 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34539] namedtuple's exec() throws segmentation fault

2018-08-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

If this is only present in 3.7.0 and not in the current branches, it implies 
there was an exec() or ceval-loop bug in that release and it has been already 
fixed.

This bug report may be out-of-date.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34481] Different behavior of C and Python impls of datetime.strftime with non-UTF-8-encodable strings

2018-08-29 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

@p-ganssle

> I'm finding it very difficult to reconcile these things.

Paul, this issue was only about reconciling C and Python implementations of 
datetime module -- not fixing time.strftime(), which both of them delegate to. 
While the latter is certainly more important, it's also much more difficult, 
and IMO needs another issue report (maybe merged with #34512). As for the 
former, it seems that you've already fixed it in your PR.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2018-08-29 Thread Eryk Sun


Eryk Sun  added the comment:

Changing the system timer resolution doesn't appear to help, given the current 
design combined with what looks like a bug in Windows (at least in Windows 10). 
We can set the system clock resolution below a millisecond via 
NtSetTimerResolution. I tested at 0.4882 ms, which allowed sleeping for 0.5 ms 
via NtDelayExectution. (NT interval resolution is 100 ns, nominally). But 
Python's threading Lock timeout is still limited to about 15-16 ms. I'd expect 
1 ms resolution given we're ultimately calling WaitForSingleObjectEx via 
PyCOND_TIMEDWAIT -> _PyCOND_WAIT_MS.

It appears the problem is that GetTickCount[64] continues to increment by 
15.625 ms (i.e. by 15 to 16), which looks like a bug to me, but may be a 
compatibility behavior. We use the tick count in EnterNonRecursiveMutex in the 
following block of code:

} else if (milliseconds != 0) {
/* wait at least until the target */
DWORD now, target = GetTickCount() + milliseconds;
while (mutex->locked) {
if (PyCOND_TIMEDWAIT(>cv, >cs, (long 
long)milliseconds*1000) < 0) {
result = WAIT_FAILED;
break;
}
now = GetTickCount();
if (target <= now)
break;
milliseconds = target-now;
}
}

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:

It was much more complicated than expected to implement this idea, but it seems 
like it's now working! I close the issue.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset fbca90856d96273fd87c0b126f6e7966af7fbf7b by Victor Stinner in 
branch 'master':
bpo-34523: Use _PyCoreConfig instead of globals (GH-9005)
https://github.com/python/cpython/commit/fbca90856d96273fd87c0b126f6e7966af7fbf7b


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34528] Windows installer: Failed to run untrusted mode.

2018-08-29 Thread Cabu


Cabu  added the comment:

Knowing the IT department, I will receive a nice letter saying that they don't 
care because it is not an approved software and that I could use Java for my 
development needs. I wanted to develop some interesting tools in python that 
could be used by a lot of colleagues to force their hand in approving it in a 
quicker way, else it will be like they have done for php and in 5 years they 
will finnally approve the use of python 2.7 (without pip to install non 
approved libraries) as a standard tool :(

If I want the latest and greatest Python environment, it would be easier for me 
to copy a working installation from my computer and update the registry and 
environment variables like the installer should do. For that purpose, do you 
have somewhere the list of registry keys and environment variables to 
insert/update?

In the meantime I have found a 'workaround': Install Anaconda. I will not have 
python 3.7, but 3.6.3 is better than nothing :/ But still a pity to install 
600MB of cruft for the 30MB of Python goodies :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8476

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19569] Use __attribute__((deprecated)) to warn usage of deprecated functions and macros

2018-08-29 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz
versions: +Python 3.8 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19569] Use __attribute__((deprecated)) to warn usage of deprecated functions and macros

2018-08-29 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +8475

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset de427556746aa41a8b5198924ce423021bc0c718 by Victor Stinner in 
branch 'master':
bpo-34523: Py_FileSystemDefaultEncoding NULL by default (GH-9003)
https://github.com/python/cpython/commit/de427556746aa41a8b5198924ce423021bc0c718


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34007] test_gdb fails in s390x SLES buildbots

2018-08-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Interestingly, everything points to something special in the glibc version of 
the buildbot. Usually the end of the stack for threads is:

(gdb)
#22 0x77f82a9d in start_thread () from /usr/lib/libpthread.so.0
(gdb)
#23 0x77d23a43 in clone () from /usr/lib/libc.so.6

but in this buildbot we get:

#24 0x03fffde88b22 in start_thread () from /lib64/libpthread.so.0
(gdb)
#25 0x03fffdb7164a in thread_start () from /lib64/libc.so.6
(gdb)
PC not saved

I think that the combination of glibc + gdb is producing this problem probably 
because the optimization level of glibc.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34485] _PyCoreConfig: add stdio_encoding and stdio_errors

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset cf21504194927b2f22132f48effea69eb8ade751 by Victor Stinner in 
branch 'master':
bpo-34485: Emit C locale coercion warning later (GH-9002)
https://github.com/python/cpython/commit/cf21504194927b2f22132f48effea69eb8ade751


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8474

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34495] excess_args asserts if args == nullptr

2018-08-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The third argument of tp_new() should be a dict or NULL.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34485] _PyCoreConfig: add stdio_encoding and stdio_errors

2018-08-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8473

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3d4226a832cabc630402589cc671cc4035d504e5 by Victor Stinner in 
branch 'master':
bpo-34523: Support surrogatepass in locale codecs (GH-8995)
https://github.com/python/cpython/commit/3d4226a832cabc630402589cc671cc4035d504e5


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34495] excess_args asserts if args == nullptr

2018-08-29 Thread Tatyana


Tatyana  added the comment:

So, user has to do

PyObject *empty_args = PyTuple_New(0);
inst = PyBaseObject_Type.tp_new(type_obj, empty_args, Py_None);
Py_DECREF(empty_args);


when type_obj doesn't require arguments for constructing?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34522] PyTypeObject's tp_base initialization bug

2018-08-29 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Eddie,

I have read the thread and still don't see why breaking existing code is a good 
thing to do.

As I wrote earlier there are two issues you're trying to address with one patch:

1) Not all types in the CPython tree are initialised using PyType_Ready

Fixing that is ok and the patch for that looks ok. But: I haven't checked if 
PyType_Ready is called before types are used, if the call to PyType_Ready is 
done after the type is already implicitly readied the call to PyType_Ready is 
purely cosmetic.

2) Using PyVarObject_HEAD_INIT(_type, ...) causes problems on Windows

I don't agree with the current patch for that because that *silently* changes 
the semantics of existing code, and hence can break existing C extensions. 

I haven't tested the patch yet, but I do have C extensions that use this 
pattern and where "_type" is not equivalent to NULL.

The correct change for the CPython tree is to change all instances of 
PyVarObject_HEAD_INIT(_type, ...) to PyVarObject_HEAD_INIT(NULL, ...), and 
then add explicit code to set the type of the type instance where "some_type" 
is not PyType_Type (AFAIK there aren't any of those in the CPython tree, but 
there are outside of CPython).


Another reason why changing PyVarObject_HEAD_INIT is not correct is that this 
can be used to initialize more than just PyTypeObject structs, as the name 
suggests it is used to initialize PyVarObject values and not just PyTypeObject 
values. Changing the macro also breaks those.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34538] Remove encouragement to author a base class for all Exception subclasses in a module

2018-08-29 Thread Brett Cannon


Brett Cannon  added the comment:

I think the question is how often in real code to people want to catch all 
exceptions produced by a package or module but not any others. Perhaps it would 
be better to re-word the advice that when there are many related exceptions 
that it is suggested you have a base class for them?

--
nosy: +brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2018-08-29 Thread Paul Overing


Paul Overing  added the comment:

Thank you to everyone for looking at my issue esp Josh.r for the detailed 
response. I now understand the issue and I just wanted to bring it to the 
group's attention for everyone's benefit.  Vstinner is correct; Linux is my 
solution as it is my production environment but I was using my windows laptop 
for dev as I've been doing frequent Asia trips lately and noticed the 
difference.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2018-08-29 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Victor, that was a little overboard. By that logic, there doesn't need to be a 
Windows version of Python.

That said, Paul doesn't seem to understand that the real resolution limit isn't 
1 ms; that's the lower limit on arguments to the API, but the real limit is the 
system clock, which has a granularity in the 10-16 ms range. It's a problem 
with Windows in general, and the cure is worse than the disease.

Per 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724411(v=vs.85).aspx 
, the resolution of the system timer is typically in the range of 10 
milliseconds to 16 milliseconds.

Per 
https://docs.microsoft.com/en-us/windows/desktop/Sync/wait-functions#wait-functions-and-time-out-intervals
 :

> Wait Functions and Time-out Intervals

> The accuracy of the specified time-out interval depends on the resolution of 
> the system clock. The system clock "ticks" at a constant rate. If the 
> time-out interval is less than the resolution of the system clock, the wait 
> may time out in less than the specified length of time. If the time-out 
> interval is greater than one tick but less than two, the wait can be anywhere 
> between one and two ticks, and so on.

All the Windows synchronization primitives (e.g. WaitForSingleObjectEx 
https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-waitforsingleobjectex
 , which is what ultimately implements timed lock acquisition on Windows) are 
based on the system clock, so without drastic measures, it's impossible to get 
better granularity than the 10-16 ms of the default system clock configuration.

The link on "Wait Functions and Time-out Intervals" does mention that this 
granularity *can* be increased, but it recommends against fine-grained tuning 
(so you can't just tweak it before a wait and undo the tweak after; the only 
safe thing to do is change it on program launch and undo it on program exit). 
Even then, it's a bad idea for Python to use it; per timeBeginPeriod's own docs 
( 
https://docs.microsoft.com/en-us/windows/desktop/api/timeapi/nf-timeapi-timebeginperiod
 ):

> This function affects a global Windows setting. Windows uses the lowest value 
> (that is, highest resolution) requested by any process. Setting a higher 
> resolution can improve the accuracy of time-out intervals in wait functions. 
> However, it can also reduce overall system performance, because the thread 
> scheduler switches tasks more often. High resolutions can also prevent the 
> CPU power management system from entering power-saving modes. Setting a 
> higher resolution does not improve the accuracy of the high-resolution 
> performance counter.

Basically, to improve the resolution of timed lock acquisition, we'd have to 
change the performance profile of the entire OS while Python was running, 
likely increasing power usage and possibly reducing performance. Global 
solutions to local problems are a bad idea.

The most reasonable solution to the problem is to simply document it (maybe not 
for queue.Queue, but for the threading module). Possibly even provide an 
attribute in the threading module similar to  threading.TIMEOUT_MAX that 
reports the system clock's granularity for informational purposes (might need 
to be a function so it reports the potentially changing granularity).

Other, less reasonable solutions, would be:

1. Expose a function (with prominent warnings about not using it in a fine 
grained manner, and the effects on power management and performance) that would 
increase the system clock granularity as much as possible timeGetDevCaps 
reports possible (possibly limited to a user provided suggestion, so while the 
clock could go to 1 ms resolution, the user could request only 5 ms resolution 
to reduce the costs of doing so). Requires some additional state (whether 
timeBeginPeriod has been called, and with what values) so timeEndPeriod can be 
called properly before each adjustment and when Python exits. Pro is the code 
is *relatively* simple and would mostly fix the problem. Cons are that it 
wouldn't be super discoverable (unless we put notes in every place that uses 
timeouts, not just in threading docs), it encourages bad behavior (one 
application deciding its needs are more important that conserving power), and 
we'd have to be *really* careful to pair our calls universally (timeEndPeriod 
mus
 t be called, even when other cleanup is skipped, such as when calling 
os._exit; AFAICT, the docs imply that per-process adjustments to the clock 
aren't undone even when the process completes, which means failure to pair all 
calls would leave the system with a suboptimal system clock resolution that 
would remain in effect until rebooted).

2. (Likely a terrible idea, and like option 1, should be explicitly opt-in, not 
enabled by default) Offer the option to have Python lock timeouts only use 
WaitForSingleObjectEx only to sleep to within one system clock tick of the 
target time (and not 

[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-08-29 Thread DeKrain


DeKrain  added the comment:

(I wrote that I'm importing from _struct just for this issue.)
I've seen that tp_new of PyStructType is set to s_new in Modules/_struct.c.
And that crash is most likely caused by access to uninitialized memory, so it 
is not guaranteed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32560] [EASY C] inherit the py launcher's STARTUPINFO

2018-08-29 Thread Shiva Saxena


Shiva Saxena  added the comment:

I am a new contributor, and happy to take this issue as my first contribution 
in cpython. I have sent a PR for the same. Please let me know if anything needs 
to be change.

--
nosy: +GeekyShacklebolt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c5989cd87659acbfd4d19dc00dbe99c3a0fc9bd2 by Victor Stinner in 
branch 'master':
bpo-34523: Py_DecodeLocale() use UTF-8 on Windows (GH-8998)
https://github.com/python/cpython/commit/c5989cd87659acbfd4d19dc00dbe99c3a0fc9bd2


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-08-29 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

_struct is a private implementation detail. You shouldn't use it. You shouldn't 
care where the implementation "really is" in your Python code, because it could 
move without warning. There are no backwards-compatibility guarantees for 
private modules like _struct.

But regardless of where you are importing it from, why are you calling 
Struct.__new__(Struct) in the first place? You should be calling Struct().

I still don't see any reason to consider this a bug. I can't reproduce your 
report of a crash:

py> from _struct import Struct
py> s = Struct.__new__(Struct)
py> b = bytearray()
py> s.pack_into(b)
Traceback (most recent call last):
  File "", line 1, in 
SystemError: null argument to internal routine


I get an exception, which is the correct behaviour. Unless this segfaults, I 
don't believe this is a bug that needs fixing.

(By the way, Struct doesn't even have a __new__ method. You are calling the 
__new__ method inherited from object, which clearly knows nothing about how to 
initialise a Struct.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34481] Different behavior of C and Python impls of datetime.strftime with non-UTF-8-encodable strings

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:

> Because caring of surrogates,

Before*

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34481] Different behavior of C and Python impls of datetime.strftime with non-UTF-8-encodable strings

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:

Because caring of surrogates, I would prefer to first fix time.strftime() and 
time.strptime() for legit time zone names. Currently, Python uses the C 
function strfime() because the string produced by wcsftime() cannot be parsed 
later. We should use the native Windows API to get the time zone name properly 
encoded. I don't recall the details, sorry. There is maybe an open issue for 
that one.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32560] [EASY C] inherit the py launcher's STARTUPINFO

2018-08-29 Thread Shiva Saxena


Change by Shiva Saxena :


--
keywords: +patch
pull_requests: +8472
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-08-29 Thread DeKrain


DeKrain  added the comment:

Well, sometimes when i do
>>> b = bytearray()
>>> s.pack_into(b)

application crashes (because it checks arg #1, which is not initialized).
Also, I imported from _struct, because it's where implementation of Struct 
really is.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2018-08-29 Thread Prudvi RajKumar Maddala


Prudvi RajKumar Maddala  added the comment:

Made changes, pathlib.Path('.').iterdir() now throws a FileNotFoundError if the 
path is not valid.

--
nosy: +prudvinit

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2018-08-29 Thread Paul Pinterits


Paul Pinterits  added the comment:

As an afterthought, I'd like to suggest an alternative solution: If changing 
the `iterdir` behavior is not possible or not desirable for some reason, please 
add a `Path.listdir` method that returns a list instead of an iterator. Lazy 
file system operations can often introduce unnecessary race conditions in the 
code, so I believe it would be very useful if every lazy method had an eager 
equivalent.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2018-08-29 Thread Prudvi RajKumar Maddala


Change by Prudvi RajKumar Maddala :


--
pull_requests: +8470

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34403] test_utf8_mode.test_cmd_line() fails on HP-UX due to false assumptions

2018-08-29 Thread Michael Felt

Michael Felt  added the comment:

On 28/08/2018 20:43, Michael Felt wrote:
> Attached is the output with LC_ALL=C in the prefix. If you were hoping
> for "dangling processes - your hopes are affirmed.

Previous mail ended with:

== Tests result: FAILURE ==

375 tests OK.

13 tests failed:
    test__xxsubinterpreters test_asyncio test_concurrent_futures
    test_ctypes test_distutils test_embed test_httpservers
    test_multiprocessing_fork test_os test_pkg test_socket
    test_subprocess test_time

30 tests skipped:
    test_curses test_dbm_gnu test_devpoll test_epoll test_gdb
    test_idle test_kqueue test_lzma test_msilib test_ossaudiodev
    test_readline test_smtpnet test_socketserver test_spwd test_sqlite
    test_startfile test_tcl test_timeout test_tix test_tk
    test_ttk_guionly test_ttk_textonly test_turtle test_urllib2net
    test_urllibnet test_winconsoleio test_winreg test_winsound
    test_xmlrpc_net test_zipfile64

Total duration: 14 min 53 sec
Tests result: FAILURE
root@x066:[/data/prj/python/git/python3-3.8]

Without LC_ALL=C summary is (different):

== Tests result: FAILURE ==

376 tests OK.

10 tests failed:
    test__xxsubinterpreters test_asyncio test_ctypes test_distutils
    test_embed test_httpservers test_multiprocessing_forkserver
    test_os test_socket test_time

32 tests skipped:
    test_curses test_dbm_gnu test_devpoll test_epoll test_gdb
    test_idle test_kqueue test_lzma test_msilib test_ossaudiodev
    test_readline test_smtpnet test_socketserver test_spwd test_sqlite
    test_startfile test_tcl test_timeout test_tix test_tk
    test_ttk_guionly test_ttk_textonly test_turtle test_unicode_file
    test_unicode_file_functions test_urllib2net test_urllibnet
    test_winconsoleio test_winreg test_winsound test_xmlrpc_net
    test_zipfile64

Total duration: 11 min 1 sec

And, rather than dangling processes, I see BrokenBarrierErrors

FYI

--
Added file: https://bugs.python.org/file47771/py3.8-default.text

___
Python tracker 

___Script command is started on Tue Aug 28 18:34:49 UTC 2018.
root@x066:[/data/prj/python/git/python3-3.8]script 
../py3.8-default.textm   
maketopas -i 5LC _ALL=C ./python -m 
test -j0 -rC _ALL=C ./python -m test -j0 -r 
 _ALL=C ./python -m test -j0 -r 
ALL=C ./python -m test -j0 -r 
LL=C ./python -m test -j0 -r 
L=C ./python -m test -j0 -r 
=C ./python -m test -j0 -r 
C ./python -m test -j0 -r  
./python -m test -j0 -r ./python -m test -j0 -r 

== CPython 3.8.0a0 (heads/master:d500e5307a, Aug 28 2018, 18:09:17) [C]
== AIX-1-00C291F54C00-powerpc-32bit big-endian
== cwd: /data/prj/python/git/python3-3.8/build/test_python_16777460
== CPU count: 8
== encodings: locale=ISO8859-1, FS=iso8859-1
Using random seed 1054694
Run tests in parallel using 10 child processes
0:00:01 [  1/418] test_dictcomps passed
0:00:01 [  2/418] test_class passed
0:00:01 [  3/418] test_global passed
0:00:01 [  4/418] test_types passed
0:00:02 [  5/418] test_unpack_ex passed
0:00:02 [  6/418] test_sysconfig passed
0:00:02 [  7/418] test_functools passed
0:00:02 [  8/418] test_frozen passed
0:00:02 [  9/418] test_bigmem passed
0:00:03 [ 10/418] test_binascii passed
0:00:03 [ 11/418] test_profile passed
0:00:03 [ 12/418] test_tabnanny passed
0:00:03 [ 13/418] test_pty passed
0:00:03 [ 14/418] test_fstring passed
0:00:03 [ 15/418] test_codecencodings_kr passed
0:00:04 [ 16/418] test_strptime passed
0:00:04 [ 17/418] test_sunau passed
0:00:04 [ 18/418] test_unicode_identifiers passed
0:00:04 [ 19/418] test_longexp passed
0:00:05 [ 20/418] test_fileio passed
0:00:05 [ 21/418] test_repl passed
0:00:06 [ 22/418] test_int passed
0:00:06 [ 23/418] test_posixpath passed
running: test_compile (35 sec 776 ms), test_lib2to3 (36 sec 396 ms), test_queue 
(35 sec 862 ms), test_multiprocessing_spawn (37 sec 717 ms), test_faulthandler 
(35 sec 494 ms), test_compileall (33 sec 460 ms), test_random (37 sec 839 ms), 
test_fork1 (38 sec 549 ms)
0:00:40 [ 24/418] test_xmlrpc passed -- running: test_compile (36 sec 924 ms), 
test_lib2to3 (37 sec 167 ms), test_queue (36 sec 613 ms), 
test_multiprocessing_spawn (38 sec 468 ms), test_faulthandler (36 sec 244 ms), 
test_compileall (34 sec 211 ms), test_random (38 sec 590 ms), test_fork1 (39 
sec 296 ms)
0:00:40 [ 25/418] test_ast passed -- running: test_compile (37 sec 6 ms), 
test_lib2to3 (37 sec 249 ms), test_queue (36 sec 695 ms), 
test_multiprocessing_spawn (38 sec 550 ms), test_faulthandler (36 sec 327 ms), 
test_compileall (34 sec 293 ms), test_random (38 sec 672 

[issue34403] test_utf8_mode.test_cmd_line() fails on HP-UX due to false assumptions

2018-08-29 Thread Michael Felt

Michael Felt  added the comment:

On 28/08/2018 13:20, STINNER Victor wrote:
> I updated my PR 8969 to implement properly my idea. With this PR, on HP-UX 
> with C or POSIX locale, Python now uses ASCII for its "filesystem encoding": 
> sys.getfilesystemencoding() returns "ascii".
>
> Michael: can you please try my updated PR 8969?
>
> * apply the updated change
> * recompile Python
> * run the test suite using: LC_ALL=C ./python -m test -j0 -r
>
> You may also test with the current locale: ./python -m test -j0 -r

Seems to work well as far as AIX and test_utf8_mode (as you had already
merged I pulled master and built that anew).

Attached is the output with LC_ALL=C in the prefix. If you were hoping
for "dangling processes - your hopes are affirmed.

Perhaps also noteworthy:

root@x066:[/data/prj/python/git/python3-3.8]set | grep LC
LC__FASTMSG=true
MAILCHECK=600
root@x066:[/data/prj/python/git/python3-3.8]set | grep LANG
LANG=en_US

--
Added file: https://bugs.python.org/file47770/py3.8-LC-C.text

___
Python tracker 

___Script command is started on Tue Aug 28 18:19:16 UTC 2018.
root@x066:[/data/prj/python/git/python3-3.8]script 
../py3.8.textrm ../py3.8.textls 
../py3.8.textls ../py3.8.text.rm 
../py3.8.text.make make 
distclean; buildaix --without-computed-gotos 
--with-openssl=/opt/aixto>cd
 *3.8 
py  
   LC _ALL=C ./python -m test -j0 -r
== CPython 3.8.0a0 (heads/master:d500e5307a, Aug 28 2018, 18:09:17) [C]
== AIX-1-00C291F54C00-powerpc-32bit big-endian
== cwd: /data/prj/python/git/python3-3.8/build/test_python_16777456
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
Using random seed 2001895
Run tests in parallel using 10 child processes
0:00:02 [  1/418] test_sqlite skipped
test_sqlite skipped -- No module named '_sqlite3'
0:00:02 [  2/418] test_startfile skipped
test_startfile skipped -- object  has no attribute 'startfile'
0:00:02 [  3/418] test_mailcap passed
0:00:02 [  4/418] test_peepholer passed
0:00:02 [  5/418] test_sort passed
0:00:02 [  6/418] test_symbol passed
0:00:02 [  7/418] test_imghdr passed
0:00:02 [  8/418] test_string_literals passed
0:00:02 [  9/418] test_functools passed
0:00:03 [ 10/418] test_crashers passed
0:00:03 [ 11/418] test_unicode_identifiers passed
0:00:03 [ 12/418] test_metaclass passed
0:00:03 [ 13/418] test_normalization passed
0:00:03 [ 14/418] test_turtle skipped
test_turtle skipped -- No module named '_tkinter'
0:00:04 [ 15/418] test_codecmaps_kr passed
0:00:04 [ 16/418] test_pprint passed
0:00:04 [ 17/418] test_bdb passed
0:00:05 [ 18/418] test_pyexpat passed
0:00:05 [ 19/418] test_sched passed
0:00:05 [ 20/418] test_dict passed
0:00:05 [ 21/418] test_setcomps passed
0:00:05 [ 22/418] test_gdb skipped
test_gdb skipped -- Couldn't find gdb on the path
0:00:06 [ 23/418] test_ttk_textonly skipped
test_ttk_textonly skipped -- No module named '_tkinter'
0:00:06 [ 24/418] test_telnetlib passed
0:00:06 [ 25/418] test_plistlib passed
0:00:06 [ 26/418] test_urllib2 passed
0:00:07 [ 27/418] test_popen passed
0:00:07 [ 28/418] test_traceback passed
0:00:08 [ 29/418] test_pipes passed
0:00:08 [ 30/418] test_bisect passed
0:00:08 [ 31/418] test_robotparser passed
0:00:08 [ 32/418] test_statistics passed
0:00:08 [ 33/418] test_dataclasses passed
0:00:09 [ 34/418] test_linecache passed
0:00:09 [ 35/418] test_abstract_numbers passed
0:00:09 [ 36/418] test_profile passed
0:00:09 [ 37/418] test_pdb passed
0:00:09 [ 38/418] test__locale passed
0:00:10 [ 39/418] test_socketserver skipped (resource denied)
test_socketserver skipped -- Use of the 'network' resource not enabled
0:00:10 [ 40/418] test_nntplib passed
0:00:10 [ 41/418] test_xmlrpc_net skipped (resource denied)
test_xmlrpc_net skipped -- Use of the 'network' resource not enabled
0:00:10 [ 42/418] test_script_helper passed
0:00:11 [ 43/418] test_dbm_dumb passed
0:00:11 [ 44/418] test_epoll skipped
test_epoll skipped -- test works only on Linux 2.6
0:00:11 [ 45/418] test_genericpath passed
0:00:12 [ 46/418/1] test_time failed
test test_time failed -- multiple errors occurred; run in verbose mode for 
details
0:00:12 [ 47/418/1] test_ordered_dict passed
0:00:13 [ 48/418/1] test_wait4 passed
0:00:13 [ 49/418/1] test_stat passed
0:00:14 [ 50/418/1] test_file passed
0:00:14 [ 51/418/1] test_getopt passed
0:00:14 [ 52/418/1] test_capi passed
0:00:15 [ 53/418/1] test_code passed
0:00:15 [ 54/418/1] test_cprofile passed
0:00:15 [ 55/418/1] test_codecencodings_jp passed
0:00:16 [ 56/418/1] test_generator_stop passed
0:00:16 [ 

[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8469

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34542] [TLS] Update test certs to future proof settings

2018-08-29 Thread Christian Heimes


Change by Christian Heimes :


--
keywords: +patch
pull_requests: +8468
stage: test needed -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2018-08-29 Thread Prudvi RajKumar Maddala


Change by Prudvi RajKumar Maddala :


--
keywords: +patch
pull_requests: +8467
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-08-29 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This exception goes back to at least Python 2.6 (if not older) but I'm not 
convinced it is a bug.

Calling __new__ alone is not guaranteed to initialise a new instance 
completely. The public API for creating an instance is to call the class object:

s = Struct()


not to call __new__. You bypassed the proper initialisation of the instance, 
resulting in a broken, half-initialised instance. When you tried to use it, it 
correctly raised an exception.

If this caused a crash or a seg fault, then it would be reasonable to report it 
as a bug, but it looks to me that this is behaving correctly.

If you disagree, please explain why you think it is a bug.


(Also, for the record, you shouldn't be importing Struct from the private 
module _struct, you should import it from the public struct module.)

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-08-29 Thread DeKrain


New submission from DeKrain :

>>> from _struct import Struct
>>> s = Struct.__new__(Struct)
>>> s.unpack_from(b'asdf')
Traceback (most recent call last):
  File "", line 1, in 
SystemError: /Objects/tupleobject.c:84: Bad argument to internal function

In Modules/_struct.c:

static PyObject *
s_unpack_internal(PyStructObject *soself, const char *startfrom) {
...
PyObject *result = PyTuple_New(soself->s_len);
// soself->s_len is -1, set in Struct.__new__

--
components: Extension Modules
messages: 324330
nosy: DeKrain
priority: normal
severity: normal
status: open
title: _struct.Struct: calling functions without calling __init__ results in 
SystemError
type: behavior
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34481] Different behavior of C and Python impls of datetime.strftime with non-UTF-8-encodable strings

2018-08-29 Thread Paul Ganssle


Paul Ganssle  added the comment:

I'm finding it very difficult to reconcile these things. I'm not entirely sure, 
but we may need to take a performance hit in normal strftime if we want to make 
this work with surrogate characters, which really does not appeal to me (though 
we can certainly improve to some degree).

One major question here: Is anyone (@vstinner, @belopolsky?) know why time's 
strftime opportunistically uses wcsftime instead of strftime? It makes the code 
*way* more complicated and difficult to read / maintain - are there platforms 
that provide wcstrftime and not strftime?

Also, related, it seems according to 
https://bugs.python.org/issue10653#msg243660 that there may have been a 
regression in issue #10653, which may be related here.

Either way, some note should probably be made in the code to clarify exactly 
*why* these choices were made in the code, in case the situation has changed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:

>  It makes the windows queue.Queue implementations with timeouts unusable in 
> low latency environments and should be documented as such. As it is slow and 
> highly variable.

Well, it seems like you have a solution which is called Linux, no?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34528] Windows installer: Failed to run untrusted mode.

2018-08-29 Thread Steve Dower


Steve Dower  added the comment:

Unfortunately, I don't have any better suggestion than trying to get your 
company policy changed :(

The "clean room" feature of our installer is not configurable (and also not in 
our code, so we can't change it without going through the upstream project). 
You will likely have similar trouble with any other installer that uses the 
same project, which includes many of Microsoft's programs - if there is an 
exception for Microsoft signed code, perhaps you could request an exception for 
PSF signed code?

If you have more information about the specific technical configuration that 
prevents this, then I may be able to follow up with people to find other ideas.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8466

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34522] PyTypeObject's tp_base initialization bug

2018-08-29 Thread Eddie Elizondo


Eddie Elizondo  added the comment:

@ronaldoussoren

* This change currently works for all CPython. If you are using this pattern 
then you probably want to be using PyType_FromSpec rather than having a static 
PyTypeObject as discussed in PEP384: https://www.python.org/dev/peps/pep-0384. 
In general, extensions should all be using PyType_FromSpec rather than static 
PyTypeObjects.

* As mentioned by Erik Bray in the e-mail thread, the usage of a static 
PyTypeObject with a PyVarObject_HEAD_INIT requires a compile-time constant. 
This causes problems cross-compatibility problems, especially with Windows. You 
can read more here: 
http://iguananaut.net/blog/programming/windows-data-import.html

In general, this pattern is just pervasive. It causes cross-compatibility 
issues, it can cause users to forget calling PyType_Ready on a type and we are 
better off without it.

Again, please read the mail thread. Everything that I'm saying here is all 
discussed there.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34399] [TLS] Update test keys to >= 2048bit

2018-08-29 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +8465

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34539] namedtuple's exec() throws segmentation fault

2018-08-29 Thread Álvaro Justen

Álvaro Justen  added the comment:

I've cloned the cpython git repository and made fresh builds here:

On v.3.6.6 (4cf1f54eb764f856fda5a394d8598c0c90d69d77) it works:

$ git checkout v3.6.6 && ./configure && make && ./python --version && 
./python namedtuple_bug.py
[...compilation lines supressed...]
Python 3.6.6

On the v.3.7.0 (1bf9cc509326bc42cd8cb1650eb9bf64550d817e) it segfaults:

$ git checkout v3.7.0 && make clean && ./configure && make && ./python 
--version && ./python namedtuple_bug.py
[...compilation lines supressed...]
Python 3.7.0
Segmentation fault

On the most recent 3.7 branch (65ef7425a32ee411d8047a4fad0fc6bb9ff733b1) it 
works:

$ git checkout 3.7 && make clean && ./configure && make && ./python 
--version && ./python namedtuple_bug.py
[...compilation lines supressed...]
Python 3.7.0+

On master branch (2c8ddcf4f14f3e4c87a6fe6678ab5ad09130c6ab) it also works:

$ git checkout master && make clean && ./configure && make && ./python 
--version && ./python namedtuple_bug.py
[...compilation lines supressed...]
Python 3.8.0a0

Note: I've tried to add a `print('works!')` at the end of the script, so we can 
see the result when it does not segfault, but adding this actually make it 
works on all versions; removing this line has the behaviour reported above.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34542] [TLS] Update test certs to future proof settings

2018-08-29 Thread Christian Heimes


New submission from Christian Heimes :

In bug #34399, I updated all RSA keys to 2048. However that not sufficient for 
future proof settings. Fedora's FUTURE crypto policy requires 3072bit RSA keys. 
Further more, I forgot to update the signature algorithm, too.

* RSA >= 3072bits
* finite field DH >= 3072bits
* signature algorithm with SHA2-256 or SHA2-384 PKCSv1 #1.5 (I don't think 
RSASSA-PSS works with OpenSSL 1.0.2 or TLS < 1.0)

--
assignee: christian.heimes
components: SSL
messages: 324324
nosy: alex, christian.heimes, dstufft, janssen
priority: normal
severity: normal
stage: test needed
status: open
title: [TLS] Update test certs to future proof settings
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34403] test_utf8_mode.test_cmd_line() fails on HP-UX due to false assumptions

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:

> Please close, issue fixed. Thank you very much.

You're welcome ;-)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34403] test_utf8_mode.test_cmd_line() fails on HP-UX due to false assumptions

2018-08-29 Thread Michael Osipov


Michael Osipov <1983-01...@gmx.net> added the comment:

Please close, issue fixed. Thank you very much.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34489] subprocess: execution of batch-files (.cmd/.bat) is vulnerable in python for windows / insufficient escape

2018-08-29 Thread Sergey G. Brester


Sergey G. Brester  added the comment:

> Would you consider adding your test suite into the regression tests as well?

Sure. Done.

> Right now, this is a well known issue on all platforms

Really? I can't imagine this for something else as windows (and it is currently 
fixed also for windows only).
Anyway if you want the same test-cases for other platforms also, the windows 
skip-constraint of new test-class "CommandTryInject" should be removed (and the 
set-up as well as "_do_execwithargs" should get additional processing for 
*nix-shell-script instead of the .bat-file).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2018-08-29 Thread Paul Overing


Paul Overing  added the comment:

Thank you for your quick response.  But 1ms resolution or not, 14.5ms does not 
seem reasonable given that in Ubuntu it is 0.049ms. Ubuntu is on average 295x 
faster.  

Also the variability in times is much higher in Windows max/avg = 9.547, 
avg/min =  8.69.

It makes the windows queue.Queue implementations with timeouts unusable in low 
latency environments and should be documented as such. As it is slow and highly 
variable.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 70fead25e503a742ad4c919b151b9b2b5facee36 by Victor Stinner in 
branch 'master':
bpo-34523: Fix config_init_fs_encoding() (GH-8991)
https://github.com/python/cpython/commit/70fead25e503a742ad4c919b151b9b2b5facee36


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8464

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34523] Choose the filesystem encoding before Python initialization (add _PyCoreConfig.filesystem_encoding)

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b2457efc78b74a1d6d1b77d11a939e886b8a4e2c by Victor Stinner in 
branch 'master':
bpo-34523: Add _PyCoreConfig.filesystem_encoding (GH-8963)
https://github.com/python/cpython/commit/b2457efc78b74a1d6d1b77d11a939e886b8a4e2c


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34222] Email message serialization enters an infinite loop when folding non-ASCII headers with long words

2018-08-29 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +8463
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34538] Remove encouragement to author a base class for all Exception subclasses in a module

2018-08-29 Thread INADA Naoki


INADA Naoki  added the comment:

> Also, it mirrors practices in the standard library  (decimal.DecimalException 
> and sqlite3.DatabaseError).

As Nathaniel said, "it's good idea in the particular circumstances of a 
particular module's implementation, but generally not."  (I removed "very" 
because it is too noisy)

For example, socket.error was migrated into OSError.
So not having base exception class for module is also "practices in the 
standard library".


> For users, it provides a way to catch possible errors that are specific to a 
> particular module.

For tutorial readers, caching errors specific to particular cause should be 
suggested, instead of particular module.


"How/When custom base exception class is useful" is very high level topic.
It's too difficult for tutorial.

If tutorial reader start using base exception class without any real benefit, 
it will lead ugly code like this:

  try:
  # some code here
  except ValueError as e:
  raise CustomValueError(e.args)
  except TypeError as e:
  raise CustomTypeError(e.args)
  except ...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34485] _PyCoreConfig: add stdio_encoding and stdio_errors

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:

Oh wow, I didn't expect that it would be so complicated to "just" get the 
encoding of sys.stdout... I had to fix many bugs to be able to do that!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34485] _PyCoreConfig: add stdio_encoding and stdio_errors

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset dfe0dc74536dfb6f331131d9b2b49557675bb6b7 by Victor Stinner in 
branch 'master':
bpo-34485: Add _PyCoreConfig.stdio_encoding (GH-8881)
https://github.com/python/cpython/commit/dfe0dc74536dfb6f331131d9b2b49557675bb6b7


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34539] namedtuple's exec() throws segmentation fault

2018-08-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The works for me.  Can you try it on a fresh build or install of Python 3.7?

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34443] enum repr should use __qualname__

2018-08-29 Thread Danish Prakash


Danish Prakash  added the comment:

Serhiy, why should __qualname__ always be used together with __module__? I 
can't seem to find a valid reason, I've been through the pep.



--
nosy: +prakashdanish

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34443] enum repr should use __qualname__

2018-08-29 Thread Danish Prakash


Change by Danish Prakash :


--
keywords: +patch
pull_requests: +8462
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34538] Remove encouragement to author a base class for all Exception subclasses in a module

2018-08-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I think the advice should stay as-is.  In my experience as a teacher, the 
possibility doesn't usually occur to people without it having been suggested.  
Also, it mirrors practices in the standard library (decimal.DecimalException 
and sqlite3.DatabaseError).  For users, it provides a way to catch possible 
errors that are specific to a particular module.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34485] _PyCoreConfig: add stdio_encoding and stdio_errors

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 177d921c8c03d30daa32994362023f777624b10d by Victor Stinner in 
branch 'master':
bpo-34485, Windows: LC_CTYPE set to user preference (GH-8988)
https://github.com/python/cpython/commit/177d921c8c03d30daa32994362023f777624b10d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34485] _PyCoreConfig: add stdio_encoding and stdio_errors

2018-08-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8461

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34527] On FreeBSD, Python 3 doesn't support support the POSIX locale

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-34485. Example:

New changeset 0b9ea4b211b24464c7d38f63e45e51c275c52dcd by Victor Stinner in 
branch '3.7':
[3.7] bpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986) (GH-8987)
https://github.com/python/cpython/commit/0b9ea4b211b24464c7d38f63e45e51c275c52dcd

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34485] _PyCoreConfig: add stdio_encoding and stdio_errors

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0b9ea4b211b24464c7d38f63e45e51c275c52dcd by Victor Stinner in 
branch '3.7':
[3.7] bpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986) (GH-8987)
https://github.com/python/cpython/commit/0b9ea4b211b24464c7d38f63e45e51c275c52dcd


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:

> Victor or Steve, do you know the resolution of perf_counter() and monotonic() 
> on Windows?

You can use:

>>> time.get_clock_info('perf_counter')
namespace(adjustable=False, implementation='clock_gettime(CLOCK_MONOTONIC)', 
monotonic=True, resolution=1e-09)

perf_counter() has usually a resolution much smaller than 1 ms (ex: 100 ns), 
whereas monotonic() has a bad resolution (around 15.6 ms).

Rounding matters for the monotonic clock on Windows :-) Python should round 
away from zero (ROUND_UP) for timeouts.

--

> I have found that using timeout with a python queue.Queue() results in an 
> average delay of  14.5ms in Windows over Ubuntu in python 3.6.5/3.7, I 
> subtracted the 1 ms timeout.

This behaviour looks correct to me. I suggest to close the issue.

Python rely on Windows API. Queue.get() uses a threading.Lock. On Windows, 
lock.acquire(timeout=timeout) uses EnterNonRecursiveMutex() which expects a 
number of a milliseconds. Even if you succeed to enhance the resolution of the 
system clock, you will still be stuck to a resolution of 1 ms because of the 
Windows API.

I'm not sure of what is your underlying question. Does it look inefficient to 
you? You can use threads or asyncio to write more efficient code. But this is 
out of the scope of the bug tracker :-)

I suggest to close this issue as "not a bug".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2018-08-29 Thread Paul Pinterits


New submission from Paul Pinterits :

The fact that `Path.iterdir()` only throws exceptions once you start iterating 
over it makes it very difficult to write correct code.

Let's look at an example: We'll iterate over all children of a directory and 
print their file size.

If we try to do it like this, the `try...except` has no effect whatsoever:

try:
children = path_that_doesnt_exist.iterdir()
except FileNotFoundError:
print("directory doesn't exist")
for path in children:
print(path.stat().st_size)

If we explicitly check whether the path exists (and is a directory), we end up 
with a race condition:

if path_that_doesnt_exist.is_dir():
print("directory doesn't exist")
else:
for path in children:
print(path.stat().st_size)

We can wrap the whole loop in a `try...except`, but then we might end up 
catching exceptions we didn't intend to catch. (For example, the exception 
that's thrown when we try to get the size of a broken symlink.)

try:
for path in path_that_doesnt_exist.iterdir():
print(path.stat().st_size)  # this can also throw FileNotFoundError
except FileNotFoundError:
print("directory doesn't exist")

We can manually call `next` on the iterator inside of a `try..except` block, 
but that's awfully verbose and requires knowledge about iterators and the 
`next` function:

children = iter(path_that_doesnt_exist.iterdir())
while True:
try:
path = next(children)
except FileNotFoundError:
print("directory doesn't exist")
break
print(path.stat().st_size)

Or we can turn the iterator into a list inside of a `try...except`, which seems 
to be the best option, but completely defeats the point of having an iterator:

try:
children = list(path_that_doesnt_exist.iterdir())
except FileNotFoundError:
print("directory doesn't exist")
else:
for path in children:
print(path.stat().st_size)

As you can see, writing correct (and good) code with `iterdir` is more 
difficult than it has any right to be. Please change this behavior so that 
exceptions are thrown immediately when `iterdir` is called.

--
components: Library (Lib)
messages: 324307
nosy: Paul Pinterits
priority: normal
severity: normal
status: open
title: pathlib.Path.iterdir doesn't throw an exception until you start iterating
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34485] _PyCoreConfig: add stdio_encoding and stdio_errors

2018-08-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8460

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34485] _PyCoreConfig: add stdio_encoding and stdio_errors

2018-08-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 315877dc361d554bec34b4b62c270479ad36a1be by Victor Stinner in 
branch 'master':
bpo-34485: stdout uses surrogateescape on POSIX locale (GH-8986)
https://github.com/python/cpython/commit/315877dc361d554bec34b4b62c270479ad36a1be


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34485] _PyCoreConfig: add stdio_encoding and stdio_errors

2018-08-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8459

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34529] add the option for json.dumps to return newline delimited json

2018-08-29 Thread ron


ron  added the comment:

Raymond Hettinger answer is incorrect.

The main difference between Json and new line delimited json is that new line 
contains valid json in each line. Meaning you can do to line #47 and what you 
will have in this line is a valid json. Unlike the regular json where if one 
bracket is wrong the while  file is unreadable. 

You can not just add /n after one "object". You need also to change the 
brackets.

Keep in mind that not all Jsons are simple.. some contains huge amount of 
nested objects inside of them. You must identify where Json start and where it 
ends without being confused by nesting jsons.


There are many programming solutions to this issue.
For example:
https://stackoverflow.com/questions/51595072/convert-json-to-newline-json-standard-using-python/


My point is that this is a new format which is going to be widely accepted 
since Google adopted it for BigQuery.

flipping strings can also be easily implemented yet Python still build a 
function to do that for the user.

I think it's wise to allow support for this with in the Json library.. saving 
the trouble for programmer from thinking how to implement it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34522] PyTypeObject's tp_base initialization bug

2018-08-29 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

BTW. And that -1 was even before considering that PyVarObject_HEAD_INIT is not 
a type-object specific macro, but a macro to staticky initialize values of 
PyVarObject.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34522] PyTypeObject's tp_base initialization bug

2018-08-29 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I was also talking about static C types, it is possible to write types with 
custom meta types in C code (even if that is even less common than using meta 
types in the first place). I have extensions where I use PyVarObject_HEAD_INIT 
without the first argument being _Type or NULL and this patch would 
break those.

This part of your patch silently changes the API for CPython in a way that is 
confusing. With your patch this code changes behaviour:

static PyTypeObject my_type = {
 PyVarObject_HEAD_INIT(_meta_type, 0),
 ...
};

This is currently valid code and I use this pattern in my code. It is easy 
enough to adjust for your patch (just add "Py_TYPE(_type) = _meta_type;" 
before the call to PyType_Ready), but that is just a change for changes sake.

Why not just change all invocations of PyVarObject_HEAD_INIT in the CPython 
tree, if any? 

I do agree that explicitly calling PyType_Ready for all types would be better, 
but that is a separate issue from changing the way the static PyTypeObject is 
initialised.  

A patch that does add calls to PyType_Ready should also ensure that this is 
done before types are actually used (otherwise there is a nonzero chance that 
the explicit calls don't actually do anything due to the calls to PyType_Ready 
in strategic places in the interpreter).

Note that your patch tries to accomplish two things:

1) PyType_Ready should be called to initialize types

2) Explicitly setting the type of PyTypeObject instances through 
PyVarObject_HEAD_INIT is not necessary in the common case. 

I agree with the first item, and am -1 on a change for the second item, but -1 
on the current patch for this.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34538] Remove encouragement to author a base class for all Exception subclasses in a module

2018-08-29 Thread INADA Naoki


INADA Naoki  added the comment:

I agree with you.

--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com