[issue32532] improve sys.settrace and sys.setprofile documentation

2018-01-10 Thread Xiang Zhang

New submission from Xiang Zhang :

I propose to mention the behaviour that "if exception raised in tracefunc or 
profilefunc, the handler will be unset" in the documentation of sys.settrace 
and sys.setprofile. I encounter this behaviour and surprised by it since I 
can't get the info from the doc. Only by digging into the source code, I can 
find out why the profile messages suddenly disappear.

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 309793
nosy: docs@python, xiang.zhang
priority: normal
severity: normal
stage: needs patch
status: open
title: improve sys.settrace and sys.setprofile documentation
type: enhancement

___
Python tracker 

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



[issue32320] Add default value support to collections.namedtuple()

2018-01-10 Thread Raymond Hettinger

Change by Raymond Hettinger :


--
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



[issue32320] Add default value support to collections.namedtuple()

2018-01-10 Thread Raymond Hettinger

Raymond Hettinger  added the comment:


New changeset 3948207c610e931831828d33aaef258185df31db by Raymond Hettinger in 
branch 'master':
bpo-32320: Add default value support to collections.namedtuple() (#4859)
https://github.com/python/cpython/commit/3948207c610e931831828d33aaef258185df31db


--

___
Python tracker 

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



[issue32531] gdb.execute can not put string value.

2018-01-10 Thread callmekohei

New submission from callmekohei :

Hello! I'm callmekohei! (^_^)/



   Problems summary


gdb.execute can not put string value.



   Steps to Reproduce


// create 
$ gcc -g foo.c

// launch sdb
$ sdb a.out

// set breakpoint
$ b foo.c:5

// run
$ run

// next
$ n



   Current Behavior


(gdb)  n
6   n = 2;
False
True



   Expected Behavior


(gdb)  n
False
False



   Code 


// .gdbinit

set startup-with-shell off

python

class Foo(gdb.Command):

def __init__(self):
gdb.Command.__init__(self \
, name= 'n'   \
, command_class   = gdb.COMMAND_USER  \
, completer_class = gdb.COMPLETE_NONE \
, prefix  = True)

def invoke(self, arg, from_tty):
output = gdb.execute(command='next',from_tty=False, to_string=True)
print(output is None)
print(output == '')

Foo()

end


// foo.c

#include 

int main(int argc, char *args[])
{
int n = 1;
n = 2;
n = 3;
n = 4;
n = 5;
n = 6;
n = 7;
n = 8;
n = 9;
printf("n = %d\n",n);
return 0;
}



   Others 


see also:

https://github.com/mono/sdb/issues/45

--
components: macOS
hgrepos: 377
messages: 309791
nosy: callmekohei, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: gdb.execute can not put string value.
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue32530] How ro fix the chm encoding in Non western european codepage(cp1252) Windows

2018-01-10 Thread Hery

New submission from Hery :

Start from Python 3.6.3, the offical chm document is full of corrputed 
character.

Example: the first page which is `What’s New In Python 3.6` `’`is `0x92` in 
cp1252 and will not display correctly in non western european code page.  An 
another example is `9.1. numbers — Numeric abstract base classes` `—` is `0x97`.

The Microsoft HTML Help does not recognise ``.

Then, how to solve it?

According to this 
https://blogs.msdn.microsoft.com/sandcastle/2007/09/29/chm-localization-and-unicode-issues-dbcsfix-exe/

I recommand to use the following command to make the hhc encoding chm as cp1252:

SbAppLocale.exe $(LCID) "%PROGRAMFILES%\HTML Help Workshop\hhc.exe" 
Path\Project.HHp

I donnot know to how to submit patch and it seems quite easy to fix by offical 
windows developer.

--
components: Windows
messages: 309790
nosy: Nim, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: How ro fix the chm encoding in Non western european codepage(cp1252) 
Windows
type: behavior
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



[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2018-01-10 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
pull_requests:  -5006

___
Python tracker 

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



[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2018-01-10 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

@bbayles: I don't think PR 5149 is related to this issue.

--

___
Python tracker 

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



[issue13214] Cmd: list available completions from the cmd.Cmd subclass and filter out EOF handler(s)

2018-01-10 Thread Daniel

Daniel  added the comment:

If you write a handler for EOF like so:

from cmd import Cmd

class FooShell(Cmd):
def do_EOF(self, args):
# exit on EOF
raise SystemExit()

shell = FooShell()
shell.cmdloop()

Then when running the shell, you can see "EOF" as an undocumented command in 
the help screen. You can see this when typing "?".

$ python fooshell.py
(Cmd) ?

Documented commands (type help ):

help

Undocumented commands:
==
EOF

I believe the correct behaviour should be (1) don't show it in the undocumented 
commands, since it's not really a command; and (2) maybe create a built-in 
command for this, since the literal string "EOF" is also caught by this handler.

--
nosy: +boompig
versions: +Python 3.6 -Python 3.3

___
Python tracker 

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



[issue32529] Call readinto in shutil.copyfileobj

2018-01-10 Thread Martin Panter

Martin Panter  added the comment:

Looks like you want to use a "readinto" method to reduce data copying.

One problem is that it is not specified exactly what kind of object 
"copyfileobj" supports reading from. The documentation only says "file-like". 
According to the glossary, this means io.RawIOBase, BufferedIOBase, or 
TextIOBase. However TextIOBase doesn't have a "readinto" method. And it 
wouldn't be hard to find that someone has written their own class that doesn't 
have "readinto" either.

The other problem is you still need to support a negative "length" value, which 
is easier to do by calling "read".

--
nosy: +martin.panter
title: improved shutil.py function -> Call readinto in shutil.copyfileobj

___
Python tracker 

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



[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2018-01-10 Thread bbayles

Change by bbayles :


--
pull_requests: +5006

___
Python tracker 

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



[issue32004] Allow specifying code packing order in audioop adpcm functions

2018-01-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

Adjusting target versions, as even though the status quo leads to mishandling 
some input data, the fix is a feature request to make the behaviour 
configurable, which restricts the change to 3.7+.

--
nosy: +ncoghlan
versions:  -Python 2.7, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue9325] Add an option to pdb/trace/profile to run library module as a script

2018-01-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

While I do think it makes sense to enhance `dis` in this regard, I'm also 
thinking it might be better to have that automatically fall back to a `python 
-m inspect module:qualname` style lookup in the event that 
`os.path.exists(infile)` is false.

So considering it out of scope for *this* issue makes sense.

--

___
Python tracker 

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



[issue29240] PEP 540: Add a new UTF-8 mode

2018-01-10 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +5005

___
Python tracker 

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



[issue32529] improved shutil.py function

2018-01-10 Thread YoSTEALTH

New submission from YoSTEALTH :

improved "copyfileobj" function to use less memory

--
messages: 309784
nosy: YoSTEALTH
priority: normal
pull_requests: 5004
severity: normal
status: open
title: improved shutil.py function
type: performance
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



[issue32526] Closing async generator while it is running does not raise an exception

2018-01-10 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

It looks like Python's tracking the "running" state of async generators wrong: 
we should have ag_running set to True when we enter asend/athrow/aclose and 
False when we exit, but instead it's being toggled back and forth on each 
*inner* send/throw on the individual coroutines.

Here's a minimal reproducer (using some random recent checkout of master):

>>> async def f():
... await asyncio.sleep(1)
... yield
... 
>>> ag = f()
>>> asend_coro = ag.asend(None)
>>> fut = asend_coro.send(None)
# Logically, ag.asend is still running, waiting for that sleep to
# finish, but we have lost track:
>>> ag.ag_running
False
# We can start another call to asend() going simultaneously
>>> fut.set_result(None)
>>> send_coro2 = ag.asend(None)
>>> send_coro2.send(None)
Traceback (most recent call last):
  File "", line 1, in 
StopIteration

It looks like async_generator did handle this case correctly, but didn't have a 
test case. I just added one: 
https://github.com/njsmith/async_generator/commit/339fc6309aa6c96244e79b517db0b98ba0ccfb2a

--
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



[issue29240] PEP 540: Add a new UTF-8 mode

2018-01-10 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 2cba6b85797ba60d67389126f184aad5c9e02ff3 by Victor Stinner in 
branch 'master':
bpo-29240: readline now ignores the UTF-8 Mode (#5145)
https://github.com/python/cpython/commit/2cba6b85797ba60d67389126f184aad5c9e02ff3


--

___
Python tracker 

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



[issue9325] Add an option to pdb/trace/profile to run library module as a script

2018-01-10 Thread Mario Corchero

Mario Corchero  added the comment:

Thanks Nick. I've sent patches for all of them but `dis`.

`dis` does not "run" the code.
Adding the -m option is basically identical to just running it on the 
__main__.py if the module is runnable or on the __init__ if it is not.

If you think there is still value on that, I am happy to send a PR for it.

--

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2018-01-10 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -4951

___
Python tracker 

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



[issue32525] Empty tuples are not optimized as constant expressions

2018-01-10 Thread Brett Cannon

Change by Brett Cannon :


--
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



[issue29137] Fix fpectl-induced ABI breakage

2018-01-10 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Yes, they're intentionally retained as no-ops, so that it remains possible to 
load old extensions that were compiled against an fpe build and refer to those 
symbols. Is there a problem?

--

___
Python tracker 

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



[issue32528] Change base class for futures.CancelledError

2018-01-10 Thread Guido van Rossum

Guido van Rossum  added the comment:

I agree with Yury, this feels too risky to consider. The "except Exception:
" code is at fault.

--

___
Python tracker 

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



[issue32525] Empty tuples are not optimized as constant expressions

2018-01-10 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

This looks like it was already fixed in Python 3.7:

$ ./python.exe
Python 3.7.0a3+ (heads/master:7f7de371f9, Jan  6 2018, 21:35:03)
[Clang 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from dis import dis
>>> def f():
...   x = ()
...   y = 2, 4
...
>>> dis(f)
  2   0 LOAD_CONST   1 (())
  2 STORE_FAST   0 (x)

  3   4 LOAD_CONST   2 ((2, 4))
  6 STORE_FAST   1 (y)
  8 LOAD_CONST   0 (None)
 10 RETURN_VALUE

--
nosy: +rhettinger
resolution:  -> out of date

___
Python tracker 

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



[issue32528] Change base class for futures.CancelledError

2018-01-10 Thread Yury Selivanov

Yury Selivanov  added the comment:

While I understand the reasons for the proposed change, I'd still be -1 for it. 
Solely on the basis of "we don't know how much this change will break, but it 
will surely break something in very subtle ways".

Another problem is that asyncio currently doesn't handle BaseExceptions that 
well.

I'll put Guido in the nosy list, maybe he'll have a different opinion on this.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue32528] Change base class for futures.CancelledError

2018-01-10 Thread Марк Коренберг

Марк Коренберг  added the comment:

Will you accept PR if I fix that ?

I think we may merge that in Python 3.8

Who can also judge us? @asvetlov, what do you think about my idea ?

--

___
Python tracker 

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



[issue32528] Change base class for futures.CancelledError

2018-01-10 Thread Yury Selivanov

Yury Selivanov  added the comment:

This is a backwards incompatible change.  IMO it's too late to change this.

--

___
Python tracker 

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



[issue29240] PEP 540: Add a new UTF-8 mode

2018-01-10 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +5003

___
Python tracker 

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



[issue22552] ctypes.CDLL returns singleton objects, resulting in usage conflicts

2018-01-10 Thread Ivan Pozdeev

Change by Ivan Pozdeev :


--
type: crash -> behavior

___
Python tracker 

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



[issue31900] localeconv() should decode numeric fields from LC_NUMERIC encoding, not from LC_CTYPE encoding

2018-01-10 Thread STINNER Victor

STINNER Victor  added the comment:

I completed my change. It now fixes locale.localeconv(), str.format() for int, 
float, complex and decimal.Decimal:

vstinner@apu$ ./python lc_numeric.py 
LC_CTYPE: ('fr_FR', 'ISO8859-1')
LC_NUMERIC: ('es_MX', 'UTF-8')
decimal_point: '.'
thousands_sep: '\u2009'
grouping: [3, 3, 0]
int.__format__: '1\u2009234'
float.__format__: '1\u2009234'
complex.__format__: '1\u2009234+0j'
Decimal.__format__: '1\u2009234'

--
Added file: https://bugs.python.org/file47377/lc_numeric.py

___
Python tracker 

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



[issue32528] Change base class for futures.CancelledError

2018-01-10 Thread Марк Коренберг

Change by Марк Коренберг :


--
components: +Library (Lib)

___
Python tracker 

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



[issue31140] Insufficient error message with incorrect formated string literal

2018-01-10 Thread Christoph Zwerschke

Christoph Zwerschke  added the comment:

I can confirm that the problem still exists in Python 3.6.4 and 3.7.0a4.

Here is another way to demonstrate it:

Create the following file test.py:

# test
hello = f"{world)}"

Note that there is a syntax error in the f-string in line 2 which has a closing 
parentheses, but no opening one.

Import this from Python 3.6.4 or 3.7.0a4:

>>> import test
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1
(world))
   ^
SyntaxError: unexpected EOF while parsing

The problem here is that the error message does not contain the name of the 
erroneous file (test.py), points to a wrong line (line 1 instead of line 2), 
and also shows parentheses instead of braces around the word "world", which are 
not there in the original code. This can make it hard to locate such errors.

Note that when there are other kinds of errors in the f-string, or other kinds 
of "unexpected EOF" in the imported file, the errorenous file is usually 
reported correctly in the error message. Only certain kinds of syntax errors in 
f-strings seem to be problematic.

--
nosy: +cito

___
Python tracker 

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



[issue32528] Change base class for futures.CancelledError

2018-01-10 Thread Марк Коренберг

Change by Марк Коренберг :


--
type:  -> enhancement

___
Python tracker 

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



[issue32528] Change base class for futures.CancelledError

2018-01-10 Thread Марк Коренберг

New submission from Марк Коренберг :

I have discoverd one very ugly pattern connected with asyncio. Many times I see 
code like this:


try:
await something()
except Exception:
log.error('Opertaion failed -- will retry later.')


Seems, everything is fine, but asyncio.CancelledError unintentionally
also suppressed in that code. So, sometimes coroutines are not cancellable.

In order to mitigate thi, we had to write:



try:
await something()
except CancelledError:
raise
except Exception:
log.error('Opertaion failed. will retry later.')


So, what I propose: Basically is to change base class for asyncio.CancelledError
from Exception (yes, I know concurrent.futures and it's `Error` class) to 
BaseException.

Just like `SystemExit` and other SPECIAL exceptions.

Yes, I know that it would be incompatible change. But I suspect that impact 
will be minimal. Documentation for concurrent.futures and asyncio does not say 
that this exception is derived from Exception.

--
components: asyncio
messages: 309772
nosy: asvetlov, socketpair, yselivanov
priority: normal
severity: normal
status: open
title: Change base class for futures.CancelledError
versions: 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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2018-01-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Please let's stick with PR 5006.

--

___
Python tracker 

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



[issue7442] _localemodule.c: str2uni() with different LC_NUMERIC and LC_CTYPE

2018-01-10 Thread STINNER Victor

STINNER Victor  added the comment:

> I prefer to close the issue and wait until more users ask for it before 
> considering again the patch, or find a different way to implement the feature 
> (support LC_NUMERIC and LC_CTYPE locales using a different encoding).

Here we are: https://bugs.python.org/issue31900

--

___
Python tracker 

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



[issue29137] Fix fpectl-induced ABI breakage

2018-01-10 Thread Matthias Klose

Matthias Klose  added the comment:

reopening. this patch introduces two new symbols unconditionally, which were 
not defined for non-pyfpe builds before (PyFPE_counter and PyFPE_jbuf).

--
nosy: +doko
status: closed -> open

___
Python tracker 

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



[issue32527] windows 7 python 3.6 : after some security updates, import ibm_db fails

2018-01-10 Thread Christian Heimes

Christian Heimes  added the comment:

ibm_db is a third-party module. Please contact the authors of the module. The C 
code of the module has a bug. It's returning NULL without setting an exception 
with PyExc_*().

--
nosy: +christian.heimes

___
Python tracker 

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



[issue32527] windows 7 python 3.6 : after some security updates, import ibm_db fails

2018-01-10 Thread Christian Heimes

Change by Christian Heimes :


--
resolution:  -> third party
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



[issue32007] nis module fails to build against glibc-2.26

2018-01-10 Thread Charalampos Stratakis

Change by Charalampos Stratakis :


--
nosy: +cstratak

___
Python tracker 

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



[issue32527] windows 7 python 3.6 : after some security updates, import ibm_db fails

2018-01-10 Thread TJG

TJG  added the comment:

The error is coming from the extension module's "connect" function 
(which is the standard DB API entry point for Python database 
interfaces). Presumably from your description, some environmental 
situation leaves it with an unconsidered code path.

This is not apparently a bug in Python; rather in the extension module 
at the Python C API level. Suggest you raise an issue in the ibm_db 
issue tracker.

--
nosy: +tjguk

___
Python tracker 

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



[issue29992] Expose parse_string in JSONDecoder

2018-01-10 Thread Adrián Orive

Adrián Orive  added the comment:

Third file

--
Added file: https://bugs.python.org/file47376/__init__.py

___
Python tracker 

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



[issue29992] Expose parse_string in JSONDecoder

2018-01-10 Thread Adrián Orive

Adrián Orive  added the comment:

Second file

--
Added file: https://bugs.python.org/file47375/decoder.py

___
Python tracker 

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



[issue32527] windows 7 python 3.6 : after some security updates, import ibm_db fails

2018-01-10 Thread Saba Kauser

New submission from Saba Kauser :

Hello,
I have a user who is complaining that python ibm_db module import fails after 
some windows 7 security update. I am not sure if this is a bug or some other 
setup issue but I could not find any other forum where I can post this query. 
Please feel free to point me to correct forum if this is not the correct place.

The error as reported by him is available here : 
https://github.com/ibmdb/python-ibmdb/issues/294#issuecomment-356254726

When run through pdb, the stack shows this:
C:\Users\IBM_ADMIN\Documents\Python>python -m pdb "test DB2 connection.py"
> c:\users\ibm_admin\documents\python\test db2 connection.py(3)()
-> import ibm_db
(Pdb) continue
Traceback (most recent call last):
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", line 
1667, in main
pdb._runscript(mainpyfile)
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", line 
1548, in _runscript
self.run(statement)
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\bdb.py", line 
431, in run
exec(cmd, globals, locals)
  File "", line 1, in 
  File "c:\users\ibm_admin\documents\python\test db2 connection.py", line 3, in 

import ibm_db
SystemError:  returned NULL without setting an error
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> c:\users\ibm_admin\documents\python\test db2 connection.py(3)()
-> import ibm_db
(Pdb)

when 'cont' is used, the control reaches python ibm_db driver that should have 
happened without having to 'cont'.

c:\users\ibm_admin\documents\python\test db2 connection.py(2)()
-> import ibm_db
(Pdb) cont
Traceback (most recent call last):
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", 
line 1667, in main
pdb._runscript(mainpyfile)
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", 
line 1548, in _runscript
self.run(statement)
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\bdb.py", 
line 431, in run
exec(cmd, globals, locals)
File "", line 1, in
File "c:\users\ibm_admin\documents\python\test db2 connection.py", line 2, in
import ibm_db
SQLCODE=-30082][CLI Driver] SQL30082N Security processing failed with reason 
"15" ("PROCESSING FAILURE"). SQLSTATE=08001
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
c:\users\ibm_admin\documents\python\test db2 connection.py(2)()
-> import ibm_db
(Pdb) cont
Post mortem debugger finished. The test DB2 connection.py will be restarted
c:\users\ibm_admin\documents\python\test db2 connection.py(2)()
-> import ibm_db
(Pdb) cont
Traceback (most recent call last):
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", 
line 1667, in main
pdb._runscript(mainpyfile)
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\pdb.py", 
line 1548, in _runscript
self.run(statement)
File "C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python36-32\lib\bdb.py", 
line 431, in run
exec(cmd, globals, locals)
File "", line 1, in
File "c:\users\ibm_admin\documents\python\test db2 connection.py", line 2, in
import ibm_db
SQLCODE=-30082][CLI Driver] SQL30082N Security processing failed with reason 
"15" ("PROCESSING FAILURE"). SQLSTATE=08001
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
c:\users\ibm_admin\documents\python\test db2 connection.py(2)()
-> import ibm_db
(Pdb)


Please note that the script works fine when run as administrator and it fails 
only when run as non-admin user. non-admin user too was working fine until 
recently when some update was applied to windows OS and then it stopped working 
only for non-admin user. Python and ibm_db driver both have be uninstalled and 
re-installed for non-admin user, but no luck.
kindly help!

--
components: Windows
messages: 309764
nosy: paul.moore, sabakauser, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: windows 7 python 3.6 : after some security updates, import ibm_db fails
type: security
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



[issue29992] Expose parse_string in JSONDecoder

2018-01-10 Thread Adrián Orive

Adrián Orive  added the comment:

I found the same problem. My case seems to be less exotic, as what I'm trying 
to do is parse some of these strings into decimal.Decimal or datetime.datetime 
formats. Returning a decimal as a string is becoming quite common in REST APIs 
to ensure there is no floating point errors.

This is not a simple "a parameter is lacking problem":

1) JSONDecoder has 6 parse_XXX attributes (parse_int, parse_float, 
parse_constant, parse_string, parse_object, parse_array) and only first 3 of 
those are offered as parameters. The three last ones fall into a different 
category as they are not actually parsers but part of the scanner logic, but 
the first 3 are simple JSON types so, why keep only 3 parsers plus the 2 
additional object hooks instead of providing a full set of parsers (arrays, 
strings, keys)?

2) JSONDecoder.__init__ method calls json.scanner.make_scanner function, so 
even when subclassing JSONDecoder and modifying some attributes after calling 
super().__init__ it will not work, the scanner needs to be reseted.

3) make_scanner is implementented in both C (c_make_scanner) and Python 
(py_make_scanner), the later is used as backup in case the former could not be 
imported. The C and Python versions behaviour IS NOT CONSISTENT.
  - c_make_scanner IGNORES JSONDecoder's parse_string attribute. This also 
applies to parse_array and parse_object attributes.
  - py_make_scanner ONLY uses it for JSON object values, keys have 
json.decoder.scanstring hardcoded.

4) ONLY make_scanner IS BEING "EXPORTED" (__all__ = ['make_scanner']) so 
knowing the existence of the two versions requires getting deep into json's 
code. This also applies to json.decoder's scanstring, JSONObject and JSONArray.


The second point would be solved by providing all the needed params, as that 
would mean that you don't need to modify the attribute after calling 
JSONDecoder.__init__. This makes more sense than mnoving the make_scanner call 
out of the __init__ method as it is clearly part of the initialization. Has to 
be noted, however, that moving the make_scanner call from the __init__ to the 
raw_decode methods, despite making less sense, would only be a performance 
degradation for the default JSONDecover as the rest are only used once.

The forth point would be solved if both the first and the third point are 
solved, as these methods (c_make_scanner, py_make_scanner, scanstring, 
JSONObject and JSONArray) would be implementation details and would not be 
needed by the user, so not exporting them would be the right choice.

So my proposal focuses on fixing the first and third point, keeping in mind 
that it needs to be backwards compatible:

The process of decoding a JSON string into a Python object can be conceptually 
divided into two steps, interpretting the characters and then transforming it 
into the corresponding Python object. The first step is what the scanner is 
doing with the character matching, the number regex, scanstring, JSONObject and 
JSONArray. The second step is what parse_int, parse_float, parse_constant, 
object_hook and object_pairs_hook attributes are for. Dividing this two steps 
its important as the first one is an implementation detail so it can stay 
hardcoded (keeping the consistency of both C and Python versions), while the 
second one is the one where the user is given some hooks to slightly modify its 
behaviour.

Adding additional hooks for arrays, strings and objects' keys will give the 
users every customization tool available. This change plus refactoring the 
first steps to use names that do not get confused with these hooks or parsers 
will solve all the points described above.

The following files represent an operational version of the json module with 
these changes applies. encoder.py and tool.py have not been modified.

It has to be taken into account that some C aceletations have been disabled as 
the C _json module hasn't been modified and thus differ in either operation or 
method signature with the new version. If these changes seem to get the 
communities aproval and are thus gonna be applied to the standard library, in 
addition to the C _json module modifications to adapt to this new version, 
lines 123 and 311, marked with '# SWAP:' need to be also modified in order to 
use the C acelerations.

--
nosy: +Adrián Orive
Added file: https://bugs.python.org/file47374/scanner.py

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-01-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I'm not using Windows, so I'm unable to test using pythonw.  You'll have to 
provide a fix, or someone else will have to.

--

___
Python tracker 

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



[issue18543] urllib.parse.urlopen shouldn't ignore installed opener when called with any SSL argument

2018-01-10 Thread Bernhard Reiter

Bernhard Reiter  added the comment:

Yesterday I ran into the same problem and I agree that it should be solved, by 
either documenting the issue or fixing it.

As the code in 
https://github.com/python/cpython/blob/master/Lib/urllib/request.py#L199
still shows the branch and
https://docs.python.org/3.7/library/urllib.request.html
today does not hint upon it, I'm adding the Python 3.7 Version indicator.

In 3.7 (dev) docs context is indicated as preferred so the situation may be a 
little bit better, but still not resolved.

Maybe a fix should change OpenerDirector() to be able to replace or remove a 
handler.

--
nosy: +ber
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



[issue32526] Closing async generator while it is running does not raise an exception

2018-01-10 Thread Joongi Kim

New submission from Joongi Kim :

Here is the minimal example code:

https://gist.github.com/achimnol/965a6aecf7b1f96207abf11469b68965

Just run this code using "python -m pytest -s test.py" to see what happens.
(My setup uses Python 3.6.4 and pytest 3.3.2 on macOS High Sierra 10.13.2)

I tried the same logic using synchornous APIs such as threading.Thread / 
time.sleep instead of loop.create_task / asyncio.sleep, it raised "ValueError: 
generator already executing" when tried to close the generator.

--

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-01-10 Thread Pox TheGreat

Pox TheGreat  added the comment:

Retested it with a freshly installed 3.6.4 version. Used the following code to 
test:

import sys
import multiprocessing


def foo():
return 'bar'


if __name__ == '__main__':
proc = multiprocessing.Process(target=foo)
proc.start()
proc.join()
with open('process_exit_code.txt', 'w') as f:
f.write(sys.version)
f.write('\nprocess exit code: ')
f.write(str(proc.exitcode))

It is very important to run the script with pythonw, not just with python. This 
is the content of the resulting process_exit_code.txt file on my machine:
3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)]
process exit code: 1

As it can be seen the problem was not fixed. The process exit code should be 0. 
By default the new multiprocessing process created uses the same interpreter as 
the creator process, so it uses pythonw too.

--

___
Python tracker 

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



[issue32526] Closing async generator while it is running does not raise an exception

2018-01-10 Thread Joongi Kim

Change by Joongi Kim :


--
components: asyncio
nosy: achimnol, asvetlov, njs, yselivanov
priority: normal
severity: normal
status: open
title: Closing async generator while it is running does not raise an exception
type: behavior
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