[issue35113] inspect.getsource returns incorrect source for classes when class definition is part of multiline strings

2018-11-02 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I think parsing with regex especially on multiline cases like here is little 
tricky handling all cases. I find AST module to be a good fit. I tried using a 
callback where every class definition is taken up and then from that line to 
rest of the program getblock can be used to get the relevant class definition. 
This takes care of the cases I have listed and returns the correct source where 
we can filter out the class we need. Hence findsource can be modified to use 
ast instead of regex given that regex was introduced in 2006 and changing class 
syntax in future might need updating this regex. A sample program I tried but 
this is the first time I am using ast module and there might be better ways to 
filter the required classes. I will try raising a PR after some discussion to 
see if any better solution exists and more tests.

# foo_ast.py

import ast
import inspect


class MyClassVisitor(ast.NodeVisitor):

def __init__(self, lines, *args, **kwargs):
self.lines = lines
super().__init__(*args, **kwargs)

def visit_ClassDef(self, node):
print('Found class "%s"' % node.name)
print("Source")
print(''.join(inspect.getblock(self.lines[node.lineno-1:])))

with open('../backups/bpo35101_1.py') as f:
source = f.read()
lines = source.splitlines(True)
tree = ast.parse(source)
MyClassVisitor(lines).visit(tree)

$ ./python.exe ../backups/foo_ast.py

Found class "Bar"
Source
class Bar:
a = """
class MultilineStringVariable:
...
"""

Found class "MultilineStringVariable"
Source
class MultilineStringVariable:

def foo(self):
pass

Found class "MultilineStringComment"
Source
class MultilineStringComment:

def foo(self):
pass

Found class "NestedClass"
Source
class NestedClass:
a = '''
class Spam:
...
'''

Found class "Nested"
Source
class Nested:

class Spam:
pass

--

___
Python tracker 

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



[issue35140] encoding problem: gbk

2018-11-02 Thread Ma Lin


Ma Lin  added the comment:

Let me give an explanation.
Run encoding_problem_gbk.py, get an error:

D:\>encoding_problem_gbk.py
  File "D:\encoding_problem_gbk.py", line 1
SyntaxError: encoding problem: gbk

If remove the comment line, run as expected.

--
nosy: +Ma Lin

___
Python tracker 

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



[issue35143] Annotations future requires unparse, but not accessible from Pythpn

2018-11-02 Thread Kay Hayen


New submission from Kay Hayen :

Hello,

in trying to know what to put into "__annotations__" at run time, the "from 
__future__ import annotations" pose a new problem. It is now necessary to 
"unparse" to ast code that is still there. 

Code to do so, is in C API "_PyAST_ExprAsUnicode", but won't work with the 
Python level ast objects.

I have a kludge, using "compile" and "exec", to get past that. It's pretty ugly 
to do it like this, and Nuitka cannot be alone in trying to predict the value 
of "__annotations__". 

This code is my "ast.unparse" replacement:

def unparse(node):
_host_node = ast.parse("x:1")

_host_node.body[0].annotation = node

r = compile(_host_node, "", "exec", 1048576, dont_inherit 
= True)

# Using exec here, to compile the ast node tree back to string,
# there is no accessible "ast.unparse", and this works as a hack
# to convert our node to a string annotation, pylint: disable=exec-used
m = {}
exec(r, m) 

return m["__annotations__"]['x']

I am caching "_host_node" in the real code.

Having a real "ast.unparse" would be better however. It seems that the building 
blocks are all there, just not in that form.

Yours,
Kay

--
messages: 329114
nosy: kayhayen
priority: normal
severity: normal
status: open
title: Annotations future requires unparse, but not accessible from Pythpn
type: enhancement
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



[issue25416] Add encoding aliases from the (HTML5) Encoding Standard

2018-11-02 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

Please note that we can only add aliases if the encodings are indeed the same. 
Given that WhatWG has made changes to several standard encodings, this is 
especially important, since our codecs are mostly based on what the Unicode 
consortium defines as these encodings.

Tests for aliases can be minimal: just verify that the codecs subsystem detects 
them and results in the correct codec being used. There's no need to download 
any WhatWG specs for this.

--

___
Python tracker 

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



[issue35144] TemporaryDirectory can't be cleaned up if there are unsearchable directories

2018-11-02 Thread lilydjwg


New submission from lilydjwg :

If the title doesn't explain clearly, here's a demo program that will fail:

import tempfile
import pathlib

def test():
  with tempfile.TemporaryDirectory(prefix='test-bad-') as tmpdir:
tmpdir = pathlib.Path(tmpdir)
subdir = tmpdir / 'sub'
subdir.mkdir()
with open(subdir / 'file', 'w'):
  pass
subdir.chmod(0o600)

if __name__ == '__main__':
  test()

I didn't expect this, and I didn't find an easy way to handle this except not 
using TemporaryDirectory at all:

import tempfile
import pathlib
import shutil
import os

def rmtree_error(func, path, excinfo):
  if isinstance(excinfo[1], PermissionError):
os.chmod(os.path.dirname(path), 0o700)
os.unlink(path)
  print(func, path, excinfo)

def test():
  tmpdir = tempfile.mkdtemp(prefix='test-good-')
  try:
tmpdir = pathlib.Path(tmpdir)
subdir = tmpdir / 'sub'
subdir.mkdir()
with open(subdir / 'file', 'w'):
  pass
subdir.chmod(0o600)
  finally:
shutil.rmtree(tmpdir, onerror=rmtree_error)

if __name__ == '__main__':
  test()

This works around the issue, but the dirfd is missing in the onerror callback.

I have this issue because my program extracts tarballs to a temporary directory 
for examination. I expected that TemporaryDirectory cleaned up things when it 
could.

What do you think? rm -rf can't remove such a directory either but this is 
annoying and I think Python can do better.

--
components: Library (Lib)
messages: 329116
nosy: lilydjwg
priority: normal
severity: normal
status: open
title: TemporaryDirectory can't be cleaned up if there are unsearchable 
directories
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



[issue35140] encoding problem: gbk

2018-11-02 Thread Windson Yang


Windson Yang  added the comment:

Thank you, Lin. Can you reproduce on your machine, I guess it is related to 
terminal encoding or text file ending. However, I can't reproduce on macOS.

--

___
Python tracker 

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



[issue35140] encoding problem: gbk

2018-11-02 Thread Ma Lin


Ma Lin  added the comment:

Yes, I can reproduce on my Windows 10 (Simplfied Chinese).
The file is a pure ASCII file, and doesn't have a BOM prefix.

--

___
Python tracker 

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



[issue23346] shutil.rmtree doesn't work correctly on FreeBSD.

2018-11-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue35143] Annotations future requires unparse, but not accessible from Python

2018-11-02 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
title: Annotations future requires unparse, but not accessible from Pythpn -> 
Annotations future requires unparse, but not accessible from Python

___
Python tracker 

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



[issue35140] encoding problem: gbk

2018-11-02 Thread 安迷

安迷  added the comment:

this problem not exist on macOS.
this problem not exist in python2.

Windows10x64   Python 3.7.0 (v3.7.0:1bf9cc5093

script have no problem with 15 blank lines.
script haveproblem with fist line '#coding:gbk' and 14 blank lines.

--

___
Python tracker 

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



[issue35140] encoding problem: gbk

2018-11-02 Thread 安迷

安迷  added the comment:

I'm sorry for my english.
Can I use Chinese?

--

___
Python tracker 

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



[issue35140] encoding problem: gbk

2018-11-02 Thread Tim Golden


Tim Golden  added the comment:

I'm afraid you'll have to use English in this forum so that all current and 
future readers have the best chance of understanding the situation. Thank you 
very much for making the effort this far.

If anyone on this issue knows of a Chinese-language forum where this issue 
could explored before coming back here, please say so. Otherwise I'll ask 
around on Twitter etc. to see what's available

--

___
Python tracker 

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



[issue32409] venv activate.bat is UTF-8 encoded but uses current console codepage

2018-11-02 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +9604

___
Python tracker 

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



[issue35140] encoding problem: gbk

2018-11-02 Thread Windson Yang


Windson Yang  added the comment:

It's fine @anmikf, keep practice :D. Let's recap what happened:

Run encoding_problem_gbk.py on Windows10 using Python 3.7.0 will cause 
"SyntaxError: encoding problem: gbk". But it will run as expected if

1. The file has less than less than 15 lines.
2. Change coding:gbk to other encoding (like utf-8)
3. Remove coding:gbk

--

___
Python tracker 

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



[issue35140] encoding problem: coding:gbk cause syntaxError

2018-11-02 Thread Windson Yang


Change by Windson Yang :


--
title: encoding problem: gbk -> encoding problem: coding:gbk cause syntaxError

___
Python tracker 

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



[issue35134] Move !Py_LIMITED_API to Include/pycapi/

2018-11-02 Thread STINNER Victor


STINNER Victor  added the comment:

> There are not just two sides. It is common to wrap new stable C API with 
> something like:
> #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x0305
> What will you do with this?

objimpl.h always includes pycapi/pycapi_objimpl.h, so I don't think that we 
need a strong rules. I propose to always add move code using "#if ... 
Py_LIMITED_API" to the pycapi/ subdirectory, even if it uses "#if 
!defined(Py_LIMITED_API)".

--

___
Python tracker 

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



[issue6717] Some problem with recursion handling

2018-11-02 Thread శ్రీనివాస్ రెడ్డి తాటిపర్తి

Change by Srinivas  Reddy Thatiparthy(శ్రీనివాస్ రెడ్డి తాటిపర్తి) 
:


--
nosy: +thatiparthy

___
Python tracker 

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



[issue35134] Move !Py_LIMITED_API to Include/pycapi/

2018-11-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Do you want to keep only stable ABI v.3.2 and move both newer stable API and 
non-stable API to the pycapi/ subdirectory? Sorry, I don't found a sense in 
this.

--

___
Python tracker 

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



[issue35144] TemporaryDirectory can't be cleaned up if there are unsearchable directories

2018-11-02 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue35143] Annotations future requires unparse, but not accessible from Python

2018-11-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Extension Modules
nosy: +lukasz.langa
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



[issue32971] Docs on unittest.TestCase.assertRaises() should clarify context manager details

2018-11-02 Thread Dave Shawley


Change by Dave Shawley :


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

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-11-02 Thread Dave Shawley


Dave Shawley  added the comment:

I added a different implementation for consideration 
(https://github.com/python/cpython/pull/10296).

--
pull_requests: +9606

___
Python tracker 

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



[issue35134] Move !Py_LIMITED_API to Include/pycapi/

2018-11-02 Thread STINNER Victor


STINNER Victor  added the comment:

> Do you want to keep only stable ABI v.3.2 and move both newer stable API and 
> non-stable API to the pycapi/ subdirectory? Sorry, I don't found a sense in 
> this.

The raw definition could be that Include/*.h is part of the stable ABI, and 
Include/pycapi/*.h are the definitions using Py_LIMITED_API and so can be 
stable or not stable depending on Py_LIMITED_API value :-)

To be honest, I'm not sure that I understand how "Py_LIMITED_API+0 >= 
0x0305" works and should be used.

I understand that you would prefer to leave PyObject_Calloc() in 
Include/objimpl.h. Honestly, I have no strong opinion on that. We can leave it 
there if you prefer.

--

Maybe the rule "move everything using Py_LIMITED_API to pycapi" is misleading.

My intent is that API in Include/*.h should not leak implementation details. It 
should be the starting point to design a new C API which does not leak any 
implementation detail:
http://pythoncapi.readthedocs.io/

It's easier with an example:


#define _PyObject_GC_TRACK(o) do { \
PyGC_Head *g = _Py_AS_GC(o); \
if (g->_gc_next != 0) { \
Py_FatalError("GC object already tracked"); \
} \
assert((g->_gc_prev & _PyGC_PREV_MASK_COLLECTING) == 0); \
...

This macro is private: it starts with "_Py", so it doesn't belong to 
Include/*.h. Moreover, it access private fields like PyGC_Head._gc_prev.

>From my point of view, the ideal API would not access *any* structure field 
>and PyGC_Header structure must not be used nor part of the C API.

--

After saying that, I looked again at my PR, and I still see private functions 
in objimpl.h. Example:

PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *);
PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t);

#define PyObject_New(type, typeobj) \
( (type *) _PyObject_New(typeobj) )
#define PyObject_NewVar(type, typeobj, n) \
( (type *) _PyObject_NewVar((typeobj), (n)) )

These functions are not excluded from Py_LIMITED_API. Since they are private, 
we are free to remove them whenever we want, so IMHO it's fine to exclude from 
Py_LIMITED_API right now if we want.

Another example:

static inline PyObject*
PyObject_INIT(PyObject *op, PyTypeObject *typeobj)
{
assert(op != NULL);
Py_TYPE(op) = typeobj;
_Py_NewReference(op);
return op;
}

It's a public function but it calls the private function _Py_NewReference(). So 
_Py_NewReference() must be part of Py_LIMITED_API somehow...

In release mode (if Py_TRACE_REFS is not defined), _Py_NewReference() is 
defined like that:

/* Without Py_TRACE_REFS, there's little enough to do that we expand code
   inline. */
static inline void _Py_NewReference(PyObject *op)
{
if (_Py_tracemalloc_config.tracing) {
_PyTraceMalloc_NewReference(op);
}
_Py_INC_TPALLOCS(op);
_Py_INC_REFTOTAL;
Py_REFCNT(op) = 1;
}

It does access to the private _Py_tracemalloc_config variable and private 
macros/functions _Py_INC_TPALLOCS(op) and _Py_INC_REFTOTAL.

We *can* always define _Py_NewReference() as a function call if Py_LIMITED_API 
is defined, but it would have an impact on performance.

Right now, I don't want to risk to introduce a performance slowdown.

I have a "Proof-of-concept" implementation of my proposed "new C API":
https://github.com/pythoncapi/cpython/

My implementation currently uses 3 defines:

* Py_NEWCAPI_NO_MACRO: replace macros with function calls PyTuple_GET_SIZE() 
becomes PyTuple_Size()
* Py_NEWCAPI_NO_STRUCT: must not use PyObject.ob_refcnt or any other field of 
Python object structures; structures should hide their fields: compilation 
error.
* Py_NEWCAPI: new C API without borrowed references, without macro, without 
struct

But this project is highly experimental and I don't want to make it upstream 
before we measured properly the impact on the performance, the API has been 
properly reviewed and discussed, and the overall project has been approved by 
core developers. For example, by writing a PEP :-)

--

In short, I'm not sure of what can or should be done right now for 
Include/pycapi/ :-)

I wrote the PR to open the discussion :-)

--

___
Python tracker 

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



[issue35144] TemporaryDirectory can't be cleaned up if there are unsearchable directories

2018-11-02 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems like a related issue : issue26660 . Maybe TemporaryDirectory can allow an 
onerror argument that is passed internally to rmtree during cleanup and state 
the same in the documentation that TemporaryDirectory can't cleanup read-only 
files?

--

___
Python tracker 

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



[issue35145] sqlite3: "select *" should autoconvert datetime fields

2018-11-02 Thread Robert Pollak


New submission from Robert Pollak :

Currently, fields are converted to datetime as described in 
https://docs.python.org/3/library/sqlite3.html#sqlite3.PARSE_COLNAMES :

'select x as "x [datetime]" from table'

In my use case I don't know the names and locations of the datetime fields in 
advance. So I would need to do pandas.read_sql_query('select * from table', 
con) and get correct datetime columns.
(My current workaround is try calling pandas.to_datetime on each text column 
afterwards.)

The type info has to be available in the sqlite database, because I see that 
SQLiteStudio correctly detects the datetime columns.

--
components: Library (Lib)
messages: 329128
nosy: jondo
priority: normal
severity: normal
status: open
title: sqlite3: "select *" should autoconvert datetime fields
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



[issue35144] TemporaryDirectory can't be cleaned up if there are unsearchable directories

2018-11-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26660] tempfile.TemporaryDirectory() cleanup exception on Windows if readonly files created

2018-11-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue35145] sqlite3: "select *" should autoconvert datetime fields

2018-11-02 Thread Robert Pollak


Robert Pollak  added the comment:

(In fact, I am currently taking the first non-missing entry of each text column 
and trying to dateutil.parser.parse it. If that works, I use pandas.to_datetime 
on the column.)

--

___
Python tracker 

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



[issue35145] sqlite3: "select *" should autoconvert datetime fields

2018-11-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +berker.peksag, ghaering

___
Python tracker 

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



[issue35146] Bad Regular Expression Broke re.findall()

2018-11-02 Thread Dan Boxall


New submission from Dan Boxall :

Hi, I'm new to regular expressions and while playing around with them I tried 
this:

>>> rex = '*New Revision:.* ([0-9]+)'
>>> re.findall(rex, text)

and got this:

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python\Python37\lib\re.py", line 223, in findall
return _compile(pattern, flags).findall(string)
  File "C:\Python\Python37\lib\re.py", line 286, in _compile
p = sre_compile.compile(pattern, flags)
  File "C:\Python\Python37\lib\sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
  File "C:\Python\Python37\lib\sre_parse.py", line 930, in parse
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Python\Python37\lib\sre_parse.py", line 426, in _parse_sub
not nested and not items))
  File "C:\Python\Python37\lib\sre_parse.py", line 651, in _parse
source.tell() - here + len(this))
re.error: nothing to repeat at position 0

--
components: Regular Expressions
messages: 329130
nosy: Callipygean, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Bad Regular Expression Broke re.findall()
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



[issue35146] Bad Regular Expression Broke re.findall()

2018-11-02 Thread Windson Yang


Windson Yang  added the comment:

The last line "re.error: nothing to repeat at position 0" shows that you should 
not put raw * as the first element, use \* instead.

--
nosy: +Windson Yang

___
Python tracker 

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



[issue35146] Bad Regular Expression Broke re.findall()

2018-11-02 Thread Dan Boxall


Dan Boxall  added the comment:

Thank you.  I realised that and if I put a dot in front it worked fine.
But it should not break the function, so they will surely want to fix the
bug?

Kind regards,
Dan Boxall

On Fri, 2 Nov 2018 at 13:56, Windson Yang  wrote:

>
> Windson Yang  added the comment:
>
> The last line "re.error: nothing to repeat at position 0" shows that you
> should not put raw * as the first element, use \* instead.
>
> --
> nosy: +Windson Yang
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue35146] Bad Regular Expression Broke re.findall()

2018-11-02 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is not a bug in Python, it is an invalid (broken) regular expression. 
There is nothing that the interpreter or the regular expression engine can do, 
because you are telling it to do something that makes no sense. What do you 
expect findall to find, if you ask it to find something nonsensical?

You say:

"repeat this pattern any number of times"

but there is no "this pattern" to be repeated. You are asking for something 
impossible. The only legitimate response is to report back that the regular 
expression is invalid and cannot be compiled, and fail immediately.

--
nosy: +steven.daprano
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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2018-11-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset b942707fc23454a998323c17e30be78ff1a4f0e7 by Pablo Galindo 
(BNMetrics) in branch 'master':
bpo-29341: Clarify that path-like objects are accepted in some os methods 
(GH-10101)
https://github.com/python/cpython/commit/b942707fc23454a998323c17e30be78ff1a4f0e7


--
nosy: +pablogsal

___
Python tracker 

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



[issue35146] Bad Regular Expression Broke re.findall()

2018-11-02 Thread Dan Boxall


Dan Boxall  added the comment:

Yes I realised that, as I said earlier.  But it could say, "Invalid regular
expression" and not produce ten lines of error messages.

On Fri, 2 Nov 2018 at 14:21, Steven D'Aprano  wrote:

>
> Steven D'Aprano  added the comment:
>
> This is not a bug in Python, it is an invalid (broken) regular expression.
> There is nothing that the interpreter or the regular expression engine can
> do, because you are telling it to do something that makes no sense. What do
> you expect findall to find, if you ask it to find something nonsensical?
>
> You say:
>
> "repeat this pattern any number of times"
>
> but there is no "this pattern" to be repeated. You are asking for
> something impossible. The only legitimate response is to report back that
> the regular expression is invalid and cannot be compiled, and fail
> immediately.
>
> --
> nosy: +steven.daprano
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2018-11-02 Thread Luna Chen


Change by Luna Chen :


--
pull_requests: +9607

___
Python tracker 

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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2018-11-02 Thread Luna Chen


Change by Luna Chen :


--
pull_requests: +9608

___
Python tracker 

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



[issue35147] _Py_NO_RETURN is always empty on GCC

2018-11-02 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

Non-existing __GNUC_MAJOR__ macro is used to check for GCC version at 
https://github.com/python/cpython/blob/b942707fc23454a998323c17e30be78ff1a4f0e7/Include/pyerrors.h#L97
 . __GNUC__ should be used instead.

--
components: Interpreter Core
messages: 329136
nosy: benjamin.peterson, berker.peksag, brett.cannon, izbyshev, serhiy.storchaka
priority: normal
severity: normal
status: open
title: _Py_NO_RETURN is always empty on GCC
type: behavior
versions: 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



[issue35147] _Py_NO_RETURN is always empty on GCC

2018-11-02 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue35147] _Py_NO_RETURN is always empty on GCC

2018-11-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Oh, this is common error!

--

___
Python tracker 

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



[issue35147] _Py_NO_RETURN is always empty on GCC

2018-11-02 Thread STINNER Victor


STINNER Victor  added the comment:

Oh right, the major version is __GNUC__:
https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html

--
nosy: +vstinner

___
Python tracker 

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



[issue35147] _Py_NO_RETURN is always empty on GCC

2018-11-02 Thread miss-islington


miss-islington  added the comment:


New changeset e2ed5adcb5db2d70cfa72da1ba8446f7aa9e05cd by Miss Islington (bot) 
(Alexey Izbyshev) in branch 'master':
bpo-35147: Fix _Py_NO_RETURN for GCC (GH-10300)
https://github.com/python/cpython/commit/e2ed5adcb5db2d70cfa72da1ba8446f7aa9e05cd


--
nosy: +miss-islington

___
Python tracker 

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



[issue35148] cannot activate a venv environment on a Swiss German windows

2018-11-02 Thread Martin Bijl-Schwab


New submission from Martin Bijl-Schwab :

There is a small bug in the activate.bat script causing problems on 
internationalized Windows systems.

C:\repo\gui>python -m venv venv

C:\repo\gui>call venv\Scripts\activate.bat
Parameterformat falsch - 850.

This translates to "Wrong parameter - 850."

For the user it is not obvious what went wrong. 

The virtual environment is setup and will work in most cases.

Link to https://bugs.python.org/issue32409.

--
components: Library (Lib)
messages: 329140
nosy: Martin Bijl-Schwab
priority: normal
pull_requests: 9610
severity: normal
status: open
title: cannot activate a venv environment on a Swiss German windows
type: behavior
versions: 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



[issue32409] venv activate.bat is UTF-8 encoded but uses current console codepage

2018-11-02 Thread Martin Bijl-Schwab


Martin Bijl-Schwab  added the comment:

it does not work as expected on swiss german (and likely other 
internationalised) windows systems. See https://bugs.python.org/issue32409

--
nosy: +Martin Bijl-Schwab

___
Python tracker 

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



[issue32409] venv activate.bat is UTF-8 encoded but uses current console codepage

2018-11-02 Thread Martin Bijl-Schwab


Martin Bijl-Schwab  added the comment:

I meant https://bugs.python.org/issue35148

--

___
Python tracker 

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



[issue35137] Exception in isinstance when __class__ property raises

2018-11-02 Thread Brett Cannon


Brett Cannon  added the comment:

I'm with Serhiy that exceptions should not be swallowed up unless there's a 
very good reason to, and in this instance there isn't if there's a bug in code 
as that low of a level as debugging that would be atrocious.

--
nosy: +brett.cannon
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



[issue35148] cannot activate a venv environment on a Swiss German windows

2018-11-02 Thread Ned Deily


Change by Ned Deily :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue35147] _Py_NO_RETURN is always empty on GCC

2018-11-02 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
pull_requests: +9611

___
Python tracker 

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



[issue35147] _Py_NO_RETURN is always empty on GCC

2018-11-02 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
pull_requests: +9612

___
Python tracker 

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



[issue35149] pip3 show causing Error for ConfigParaser

2018-11-02 Thread Dileep

New submission from Dileep :

I' receiving error while viewing the package info of ConfigParser.

The command `pip3 show ConfigParser` doesn't cause any error where as following 
batch script is resulting this error

It has something to do with Autor name or Unicode handling of the Pip3
`for /f "tokens=1,2 delims=:" %a in ('pip3 show ConfigParser') do echo %a : %b`
 
Traceback (most recent call last):
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\logging\__init__.py", line 995, in emit
stream.write(msg)
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\site-packages\pip\_vendor\colorama\ansitowin32.py",
 line 141, in write
self.write_and_convert(text)
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\site-packages\pip\_vendor\colorama\ansitowin32.py",
 line 169, in write_and_convert
self.write_plain_text(text, cursor, len(text))
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\site-packages\pip\_vendor\colorama\ansitowin32.py",
 line 174, in write_plain_text
self.wrapped.write(text[start:end])
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u0141' in position 
8: character maps to 
Call stack:
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "C:\Program Files (x86)\Microsoft Visual 
Studio\Shared\Python36_64\Scripts\pip3.exe\__main__.py", line 9, in 
sys.exit(main())
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\site-packages\pip\_internal\__init__.py", line 
78, in main
return command.main(cmd_args)
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\site-packages\pip\_internal\cli\base_command.py", 
line 143, in main
status = self.run(options, args)
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\site-packages\pip\_internal\commands\show.py", 
line 47, in run
results, list_files=options.files, verbose=options.verbose):
  File "c:\program files (x86)\microsoft visual 
studio\shared\python36_64\lib\site-packages\pip\_internal\commands\show.py", 
line 145, in print_results
logger.info("Author: %s", dist.get('author', ''))
Message: 'Author: %s'
Arguments: ('Łukasz Langa',)

--
messages: 329144
nosy: mdileep
priority: normal
severity: normal
status: open
title: pip3 show causing Error for  ConfigParaser

___
Python tracker 

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



[issue35148] cannot activate a venv environment on a Swiss German windows

2018-11-02 Thread Vinay Sajip


Vinay Sajip  added the comment:

So - are you saying that chcp prints "850." when asked for the current code 
page but won't accept "850." when setting the code page, requiring just "850"?

--

___
Python tracker 

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



[issue33000] IDLE Doc: Text consumes unlimited RAM, consoles likely not

2018-11-02 Thread Big Stone


Big Stone  added the comment:

for the record, since summer 2018, idlex-1.18 is compatible again with 
Python-3.6+: the author simply forked the old IDLE library IDLEX was depending 
on.

so IDLEX icon in recent Winpython is"truly" IDLEX again.

--

___
Python tracker 

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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2018-11-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 8d2f88fb17468642813108977bb9ec5f7a065b84 by Pablo Galindo 
(BNMetrics) in branch '3.6':
[3.6]bpo-29341: Backport b942707 3.6 (GH-10299)
https://github.com/python/cpython/commit/8d2f88fb17468642813108977bb9ec5f7a065b84


--

___
Python tracker 

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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2018-11-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 08026b103ea8f4c9f2b5045ef7806dd8b760da2b by Pablo Galindo 
(BNMetrics) in branch '3.7':
[3.7]bpo-29341: Backport b942707 3.7 (#10298)
https://github.com/python/cpython/commit/08026b103ea8f4c9f2b5045ef7806dd8b760da2b


--

___
Python tracker 

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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2018-11-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The docstrings are fixed and the m(anual!) backports to 3.7 and 3.6 are done. 
Very good job, Luna!

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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2018-11-02 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The docstrings are fixed and the (manual!) backports to 3.7 and 3.6 are done. 
Very good job, Luna!

--

___
Python tracker 

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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2018-11-02 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
Removed message: https://bugs.python.org/msg329149

___
Python tracker 

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



[issue35150] Misc/README.valgrind out-of-date

2018-11-02 Thread Robert Henry


New submission from Robert Henry :

File Misc/README.valgrind is out of date with respect to python3.8.  There are 
important sections of this file that are 15 years old!

Example: the README.valgrind refers to "Uncomment Py_USING_MEMORY_DEBUGGER in 
Objects/obmalloc.c" but there's no such symbol in obmalloc.c (There is in 
Python/dtoa.c)

I have no idea if the valgrind suppression file Misc/valgrind-python.supp is up 
to date, but it bears examination by an expert.

--
assignee: docs@python
components: Documentation
messages: 329151
nosy: docs@python, rrh
priority: normal
severity: normal
status: open
title: Misc/README.valgrind out-of-date
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



[issue35147] _Py_NO_RETURN is always empty on GCC

2018-11-02 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 29abad099535f4bcb1531df93bafbd75b26d6adc by Victor Stinner 
(Alexey Izbyshev) in branch '3.6':
[3.6] bpo-35147: Fix _Py_NO_RETURN for GCC (GH-10300) (GH-10302)
https://github.com/python/cpython/commit/29abad099535f4bcb1531df93bafbd75b26d6adc


--

___
Python tracker 

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



[issue26660] tempfile.TemporaryDirectory() cleanup exception on Windows if readonly files created

2018-11-02 Thread Mayank Asthana


Mayank Asthana  added the comment:

I think it is OK to delete read-only files since they are in a 
TemporaryDirectory and should be expected to be temporary. A note in the 
documentation about this behaviour should be sufficient.

--
nosy: +masthana

___
Python tracker 

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



[issue34897] distutils test errors when CXX is not set

2018-11-02 Thread Tal Einat


Tal Einat  added the comment:

`not cmd` will but true if cmd is None, so it is completely equivalent to `cmd 
is None or not cmd`.  This is a purely stylistic change which doesn't alter the 
logic.

To get a clear understanding of what's going on, I recommend reading the short 
"Truth Value Testing" section in the docs:
https://docs.python.org/library/stdtypes.html#truth-value-testing

--

___
Python tracker 

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



[issue34897] distutils test errors when CXX is not set

2018-11-02 Thread Tal Einat


Tal Einat  added the comment:

`not cmd` will be true if cmd is None, so it is completely equivalent to `cmd 
is None or not cmd`.  This is a purely stylistic change which doesn't alter the 
logic.

To get a clear understanding of what's going on, I recommend reading the short 
"Truth Value Testing" section in the docs:
https://docs.python.org/library/stdtypes.html#truth-value-testing

--

___
Python tracker 

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



[issue34897] distutils test errors when CXX is not set

2018-11-02 Thread Tal Einat


Change by Tal Einat :


--
Removed message: https://bugs.python.org/msg329154

___
Python tracker 

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



[issue35104] IDLE: On macOS, Command-M minimizes & opens "Open Module..."

2018-11-02 Thread Tal Einat


Tal Einat  added the comment:

I agree with Ned's analysis. The shortcut for macOS should be changed, or 
simply removed if there's no good candidate for a shortcut.

Terry, what do you suggest?

--

___
Python tracker 

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



[issue35145] sqlite3: "select *" should autoconvert datetime fields

2018-11-02 Thread Paul Ganssle


Paul Ganssle  added the comment:

According to the sqlite documentation, there's no fundamental datetime type in 
sqlite: https://www.sqlite.org/datatype3.html#date_and_time_datatype


SQLite does not have a storage class set aside for storing dates
and/or times. Instead, the built-in Date And Time Functions of SQLite
are capable of storing dates and times as TEXT, REAL, or INTEGER values


If you have an arbitrary database whose schema you don't know, I'm not sure it 
would be possible to automatically determine that it's a datetime, though it 
appears that Python already provides this functionality by exposing the 
converters "date" and "timestamp" ( 
https://docs.python.org/3/library/sqlite3.html#default-adapters-and-converters )

If you don't know the schema you can't be 100% accurate on which columns are 
datetime, but apparently datetime types that are text will be of the format 
"-MM-DD HH:MM:SS.SSS", which is a variant of iso8601, REAL columns will be 
Julian day numbers and integers will be epoch time.

If you assume that all your datetime columns will be TEXT and that any TEXT 
column that happens to be a valid date of is a datetime column, then you can 
either use:

datetime.strftime(text_column, "%Y-%m-%d %H:%M:%S.%f")

Or if you want to be faster and less strict (this will allow several other 
variations on ISO 8601):

datetime.fromisoformat(text_column)

I would not recommend using `dateutil.parser.parse`, as the dateutil parser is 
intended for taking something you know to be a string representing a datetime 
and getting you a datetime object from it. It is not designed to tell you 
whether something is or is not a datetime.

--
nosy: +p-ganssle

___
Python tracker 

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



[issue35104] IDLE: On macOS, Command-M minimizes & opens "Open Module..."

2018-11-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I routinely use Alt-M to open modules on Windows, so I would want a shortcut on 
Mac also.  I just made a 'Mac-module' custom keyset with Control-Key-M for 
open-module, and it works.  It that acceptable?

We do not usually change default keysets, but this amounts to a bugfix in 
relation to current MacOS.  I would add it to the IDLE section of What's New.

Ned, is the system use of CMD-M newer than IDLE's (15 years?)?

--

___
Python tracker 

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



[issue35148] cannot activate a venv environment on a Swiss German windows

2018-11-02 Thread Eryk Sun


Eryk Sun  added the comment:

The Windows command line often has inconsistently localized strings. In this 
case it's from the ulib.dll utility library. For German, message 0x7692 in 
"de-DE\ulib.dll.mui" is "Aktive Codepage: %1.\r\n", which has a period after 
the %1 insert. In the English UI it's "Active code page: %1\r\n", with no 
period. I commented on the PR that we could work around this by adding "." to 
the list of token delimiters (delims).

--
nosy: +eryksun

___
Python tracker 

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



[issue35131] Cannot access to customized paths within .pth file

2018-11-02 Thread Ned Deily


Change by Ned Deily :


--
components: +Windows -Library (Lib)
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue35084] binascii.Error: Incorrect padding

2018-11-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

TestUser, please re-read and follow Serhiy's request.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue35105] Document that CPython accepts "invalid" identifiers

2018-11-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

It is an implementation detail that some people need to know, and that is very 
unlikely to change.  In the pydev thread, Guido said
"
My feeling is that limiting it to strings is fine, but checking those
strings for resembling identifiers is pointless and wasteful."

We occasionally document such things in a 'CPython implementation detail' note. 
 I don't know the proper markup for these.  At present, I think the note should 
be in setattr and **kwargs docs.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue35104] IDLE: On macOS, Command-M minimizes & opens "Open Module..."

2018-11-02 Thread Ned Deily


Ned Deily  added the comment:

> is the system use of CMD-M newer than IDLE's (15 years?)?

macOS has been using CMD-M for minimize for quite a while.  It's listed in the 
current Apple "Human Interface Guidelines" which is the reference document that 
Apple itself and third-parties are strongly encouraged to follow (sort of the 
PEP 8 for macOS UIs).  It's probably a good idea for anyone working on the IDLE 
UI to read through the macOS section at least once.

Note that they discourage the use of the Control key as a modifier and they 
also encourage the use of the Shift key as a secondary modifier "when a 
shortcut complements another shortcut".  Following those suggestions, perhaps a 
better choice for "Open Module" would be Shift-Command-O (complementing "Open 
File" Command-O), if it isn't already being used by IDLE.

https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/keyboard/

--

___
Python tracker 

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



[issue35144] TemporaryDirectory clean-up fails with unsearchable directories

2018-11-02 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: TemporaryDirectory can't be cleaned up if there are unsearchable 
directories -> TemporaryDirectory clean-up fails with unsearchable directories

___
Python tracker 

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



[issue35104] IDLE: On macOS, Command-M minimizes & opens "Open Module..."

2018-11-02 Thread Tal Einat


Tal Einat  added the comment:

Indeed Command-M has been in use for a while.

+1 for Shift-Command-o. I don't see it used in the default key config 
(Lib/idlelib/config-keys.def).

We already use Shift-Command-s for "Save As...", so this would be a consistent 
use of a Shift-Command modifier.

--

___
Python tracker 

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



[issue35084] binascii.Error: Incorrect padding

2018-11-02 Thread TestUser


TestUser  added the comment:

One of the problems reporting is the archaic way the bug trackers work.
Sorry fo the confusion except I am not sure of the exact request.

On my end I have provided what I can. You are welcome to fire up a VM and
run the sample submitted.

All the best.

On Fri, Nov 2, 2018, 4:09 PM Terry J. Reedy 
> Terry J. Reedy  added the comment:
>
> TestUser, please re-read and follow Serhiy's request.
>
> --
> nosy: +terry.reedy
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue35104] IDLE: On macOS, Command-M minimizes & opens "Open Module..."

2018-11-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I like the idea, but for me, Shift-Command-o does the same as Command-o -- open 
file, and setting open-module to shift-command-key-o does not override this.

--

___
Python tracker 

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



[issue35104] IDLE: On macOS, Command-M minimizes & opens "Open Module..."

2018-11-02 Thread Tal Einat


Tal Einat  added the comment:

Terry, does Shift-Command-s trigger "Save" or "Save As" for you? If "Save As", 
then surely this is something that can be worked out?

--

___
Python tracker 

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



[issue35143] Annotations future requires unparse, but not accessible from Python

2018-11-02 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue35150] Misc/README.valgrind out-of-date

2018-11-02 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Thank you for the report.  Closing as a duplicate of issue32666.

--
nosy: +cheryl.sabella
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Valgrind documentation seems to need updating

___
Python tracker 

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



[issue32666] Valgrind documentation seems to need updating

2018-11-02 Thread STINNER Victor


STINNER Victor  added the comment:

You may want to use PYTHONMALLOC=malloc environment variable, which changes the 
memory allocator from Python pymalloc to the regular libc malloc(). Valgrind 
false alarms come from pymalloc.

--
nosy: +vstinner

___
Python tracker 

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



[issue35105] Document that CPython accepts "invalid" identifiers

2018-11-02 Thread STINNER Victor


STINNER Victor  added the comment:

> I don't know the proper markup for these.

It's ".. impl-detail::". See for example:
https://docs.python.org/dev/library/codecs.html#standard-encodings

--

___
Python tracker 

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



[issue34547] Wsgiref server does not handle closed connections gracefully

2018-11-02 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

Closing this as a duplicate. Please carry over to issue 27682 any PR's that are 
still current.

--
nosy: +chris.jerdonek
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> wsgiref: Windows Error 10053, ConnectionAbortedError: [WinError 
10053] An established connection was aborted by the software in your host 
machine

___
Python tracker 

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



[issue27682] wsgiref BaseHandler / SimpleHandler can raise additional errors when handling an error

2018-11-02 Thread Chris Jerdonek


Change by Chris Jerdonek :


--
stage:  -> test needed
title: wsgiref: Windows Error 10053, ConnectionAbortedError: [WinError 10053] 
An established connection was aborted by the software in your host machine -> 
wsgiref BaseHandler / SimpleHandler can raise additional errors when handling 
an error
type:  -> behavior
versions: +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



[issue27682] wsgiref BaseHandler / SimpleHandler can raise additional errors when handling an error

2018-11-02 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

This seems like a bug in wsgiref.BaseHandler to me. BaseHandler.run() calls 
handle_error() if an error occurs inside finish_response():
https://github.com/python/cpython/blob/e2ed5adcb5db2d70cfa72da1ba8446f7aa9e05cd/Lib/wsgiref/handlers.py#L141

However, finish_response() calls close() in its finally block:
https://github.com/python/cpython/blob/e2ed5adcb5db2d70cfa72da1ba8446f7aa9e05cd/Lib/wsgiref/handlers.py#L177-L183

--
nosy: +chris.jerdonek

___
Python tracker 

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



[issue35131] Cannot access to customized paths within .pth file

2018-11-02 Thread Steve Dower


Steve Dower  added the comment:

I'll mark this easy as well, since adding that handler is straightforward. 
Unless someone knows a reason we shouldn't do that either.

--
keywords: +easy
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



[issue35131] Cannot access to customized paths within .pth file

2018-11-02 Thread Steve Dower


Steve Dower  added the comment:

Can you save your file in gbk encoding? That will be an immediate fix.

I don't know that we can/should change the encoding we read without checking 
with everyone who writes out .pth files. (+Jason as a start here, but I suspect 
there are more tools that write them.)

We could add a handler for UnicodeDecodeError that falls back on utf-8? I think 
that's reasonable.

--
nosy: +jason.coombs

___
Python tracker 

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



[issue35151] Python 2 xml.etree.ElementTree documentation tutorial uses undocumented arguments

2018-11-02 Thread Joshua Honeycutt


New submission from Joshua Honeycutt :

In python 2 documentation 19.7.1.6
(https://docs.python.org/2/library/xml.etree.elementtree.html#parsing-xml-with-namespaces)
a second argument (ns) is passed to find and findall.

However 19.7.3.2 
(https://docs.python.org/2/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.find)
only specifies the single match argument.

If we compare the python 3 documentation the namespaces argument is included in 
the find method. 
(https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.find)

Maybe the tutorial was created for python 3 version? I assume the function 
arguments are automatically generated, but I have not tested or tried these 
functions in python 2. I just stumbled on the docs while working with python 3.

--
assignee: docs@python
components: Documentation
messages: 329174
nosy: docs@python, epakai
priority: normal
severity: normal
status: open
title: Python 2 xml.etree.ElementTree documentation tutorial uses undocumented 
arguments
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



[issue35147] _Py_NO_RETURN is always empty on GCC

2018-11-02 Thread miss-islington


miss-islington  added the comment:


New changeset a9122d183b1fbc4484d72aec69fc0979c7fd91f2 by Miss Islington (bot) 
(Alexey Izbyshev) in branch '3.7':
[3.7] bpo-35147: Fix _Py_NO_RETURN for GCC (GH-10300) (GH-10301)
https://github.com/python/cpython/commit/a9122d183b1fbc4484d72aec69fc0979c7fd91f2


--

___
Python tracker 

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



[issue35121] Cookie domain check returns incorrect results

2018-11-02 Thread Windson Yang


Windson Yang  added the comment:

I wonder 
https://github.com/python/cpython/blob/master/Lib/test/test_http_cookiejar.py#L420
 

("http://foo.bar.com/";, "com", True),
("http://foo.com/";, "com", True),

are expected behavior?

--
nosy: +Windson Yang

___
Python tracker 

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



[issue35147] _Py_NO_RETURN is always empty on GCC

2018-11-02 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Alexey Izbyshev!

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



[issue35131] Cannot access to customized paths within .pth file

2018-11-02 Thread Windson Yang


Windson Yang  added the comment:

Hello, Valentin Zhao, do you have time to fix it? Or I can create a PR

--
nosy: +Windson Yang

___
Python tracker 

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



[issue35121] Cookie domain check returns incorrect results

2018-11-02 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Good catch Windson! I overlooked the tests. There is also a comment that it's 
liberal in the test function. Since the code was added in 2006 I don't if it's 
ok broken to fix this or not. I will let the reviewers take a call then. There 
is also domain_match and user_domain_match that perform more tests.

> This is only a rough check for performance reasons, so it's not too critical 
> as long as it's sufficiently liberal.

Thanks for your input!

--

___
Python tracker 

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



[issue35113] inspect.getsource returns incorrect source for classes when class definition is part of multiline strings

2018-11-02 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I tried ast module and it passes my test cases but I found another case since 
object.__name__ returns unqualified name thus matching against nested class 
names might conflict with the ones on the top level. Example is below where 
there is Spam at the module level and NestedA.Spam which is defined inside 
another class. getsource(NestedA.Spam) returns the source for Spam which is 
also unexpected. It seems ast module also doesn't call visit_ClassDef on nested 
class definitions thus my approach also couldn't detect NestedA.Spam and 
returns source for Spam. I wish class objects also had some kind of code 
attribute similar to functions so that line number is attached. I don't know 
the internals so I might be wrong here. I am adding Yury.

import inspect

class Egg:

def func(self):
pass

class NestedA:

class Egg:
pass


print(inspect.getsource(NestedA.Egg))
print(inspect.getsource(Egg))

# Output

class Egg:

def func(self):
pass

class Egg:

def func(self):
pass

--
nosy: +yselivanov

___
Python tracker 

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



[issue35113] inspect.getsource returns incorrect source for classes when class definition is part of multiline strings

2018-11-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Use __qualname__.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue35113] inspect.getsource returns incorrect source for classes when class definition is part of multiline strings

2018-11-02 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks Serhiy, object.__qualname__ can be used to get qualified name of the 
object but ast nodes don't have qualified name for the node where I can match 
against it. node.name returns unqualified name and hence using ast module I 
can't differentiate between Spam and NestedA.Spam since both return 'Spam' for 
node.name . I am also using a recursive decorator found at 
https://stackoverflow.com/a/14661325/2610955 which solves problem iterating 
through nested classes. But for matching module level class object and nested 
class level object when I parse a syntax tree for Spam and NestedA.Spam both 
nodes for class definition return 'Spam'. Is there a way to get qualified names 
in ast module or do I need to store it somewhere? My current approach for 
inspect.findsource is as below : 


class ClassVisitor(ast.NodeVisitor):

def recursive(func):
""" decorator to make visitor work recursive """
def wrapper(self, node):
func(self, node)
for child in ast.iter_child_nodes(node):
self.visit(child)
return wrapper

def __init__(self, source, name, *args, **kwargs):
self.source = source
self.line_number = None
self.name = name
super().__init__(*args, **kwargs)

@recursive
def visit_ClassDef(self, node):
# Need to match qualified name to differentiate between Spam and 
NestedA.Spam
if node.name == self.name:
# decrement by one since lines list starts with indexing by zero
self.line_number = node.lineno - 1

name = object.__name__ # can use object.__qualname__ but node.name is not 
qualified
source = ''.join(lines)
tree = ast.parse(source)
class_visitor = ClassVisitor(source, name)
class_visitor.visit(tree)

if class_visitor.line_number is not None:
return lines, class_visitor.line_number
else:
raise OSError('could not find class definition')

--

___
Python tracker 

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



[issue35113] inspect.getsource returns incorrect source for classes when class definition is part of multiline strings

2018-11-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Use a stack of names. Every time when you enter a class and function nodes, 
push the current name on the stack, and pop it out after handling child nodes. 
Compare the qualified name with '.'.join(self.stack). Don't use the recursive 
decorator, it is not suitable for this, because you need to execute some code 
before and after handling child nodes. Just add a loop for child nodes in your 
handler.

Yet one thing that you should take to account: decorators. In you should return 
the line number of the first decorator if they are used. This is easy.

This is an interesting issue. I would take it if you do not already working on 
it. But I think it should be interesting and useful to you. Good practice. Once 
you get some working code, create a PR. I will suggest next steps.

--

___
Python tracker 

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



[issue35144] TemporaryDirectory clean-up fails with unsearchable directories

2018-11-02 Thread lilydjwg


lilydjwg  added the comment:

Yes issue26660 is similar but not the same. On Windows it seems a read-only 
file cannot be deleted while on Linux a file resident in a non-searchable 
directory cannot be deleted.

An onerror for TemporaryDirectory will work. Also I'd like to add an optional 
dir_fd argument for onerror.

--

___
Python tracker 

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



[issue35144] TemporaryDirectory clean-up fails with unsearchable directories

2018-11-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am working on this. Left to test on Windows and analyze possible security 
issues.

--

___
Python tracker 

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



[issue26660] tempfile.TemporaryDirectory() cleanup exception on Windows if readonly files created

2018-11-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am working on this. Left to test on Windows and analyze possible security 
issues.

--

___
Python tracker 

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