[issue33376] [pysqlite] Duplicate rows can be returned after rolling back a transaction

2018-04-27 Thread cary

New submission from cary :

# Description
Rolling back a transaction causes all statements associated with that 
transaction to be reset, which allows the statements to be used again from the 
pysqlite statement cache. This can interact with various methods on `Cursor` 
objects to cause these statements to be reset again, possibly when they are in 
use by a different cursor.

This appears to be very similar to issue10513 and issue23129.

# Impact
Duplicate rows will be returned. Exceptions can be raised.

# Repro steps
  - Cursor *A* executes query *X*
  - Rollback occurs
  - Cursor *B* executes query *X*
  - Any of the following (and there might be other cases too):
- Cursor *A* is closed
- Cursor *A* is deallocated
- Cursor *A* executes any other query.
  - Result: Cursor *B* returns duplicate rows.
  - Furthermore: Executing query *X* again afterwards raises 
`sqlite3.InterfaceError`

# Possible solutions
  - Similar to the solution for issue10513 and issue23129, we could remove 
`pysqlite_do_all_statements(self, ACTION_RESET, 1)` from 
`pysqlite_connection_rollback`. This fixes the given issue, but I'm not sure 
what the implications are for the rest of the system.

  - Do not reset `self->statement` in `Cursor` if `self->reset`. This is the 
fix we've adopted for now (through a local patch to our Python), but it's worth 
noting that this is rather brittle, and only works because 
`pysqlite_do_all_statements` is always called with `reset_cursors = 1`, and 
`self->reset` is not modified in too many places.

# Example
```
import sqlite3 as sqlite

if __name__ == '__main__':
conn = sqlite.connect(":memory:")
conn.executescript("""
CREATE TABLE t(c);
INSERT INTO t VALUES(0);
INSERT INTO t VALUES(1);
INSERT INTO t VALUES(2);
""")

curs = conn.cursor()
curs.execute("BEGIN TRANSACTION")
curs.execute("SELECT c FROM t WHERE ?", (1,))
conn.rollback()

# Reusing the same statement from the statement cache, which has been
# reset by the rollback above.
gen = conn.execute("SELECT c FROM t WHERE ?", (1,))

# Any of the following will cause a spurious reset of the statement.
curs.close()
# curs.execute("SELECT 1")
# del curs

# Expected output: [(0,), (1,), (2,)]
# Observed output: [(0,), (0,), (1,), (2,)]
print(list(gen))

# Raises `sqlite3.InterfaceError: Error binding parameter 0 - probably 
unsupported type.`
conn.execute("SELECT c FROM t WHERE ?", (1,))
```

--
components: Extension Modules
messages: 315862
nosy: cary
priority: normal
severity: normal
status: open
title: [pysqlite] Duplicate rows can be returned after rolling back a 
transaction
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, 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



[issue33374] generate-posix-vars failed when building Python 2.7.14 on Linux

2018-04-27 Thread Ned Deily

Change by Ned Deily :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue32718] Install PowerShell activation scripts for venv for all platforms

2018-04-27 Thread Brett Cannon

Change by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue33366] `contextvars` documentation incorrectly refers to "non-local state".

2018-04-27 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6317

___
Python tracker 

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



[issue33366] `contextvars` documentation incorrectly refers to "non-local state".

2018-04-27 Thread Yury Selivanov

Yury Selivanov  added the comment:

Thank you, Tom!

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



[issue33363] async for statement is not a syntax error in sync context

2018-04-27 Thread Yury Selivanov

Yury Selivanov  added the comment:

Thanks so much!

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



[issue33363] async for statement is not a syntax error in sync context

2018-04-27 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset a93a663d6c2fdfbddbda9729c96e2737c0012522 by Yury Selivanov (Zsolt 
Dollenstein) in branch '3.7':
[3.7] bpo-33363: raise SyntaxError for async for/with outside async functions 
(GH-6616). (GH-6619)
https://github.com/python/cpython/commit/a93a663d6c2fdfbddbda9729c96e2737c0012522


--

___
Python tracker 

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



[issue33373] Tkinter ttk Label background ignored on MacOS

2018-04-27 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

ttk Label backgrounds work fine on Windows and, possibly, Linux (Serhiy?), and 
even, possibly with tcl/tk 8.6 on macOS (Ned?).  tk 8.6 for macOS has gotten 
several bug fixes.  C.D., please download and try out the python.org 3.7.0b3 
macOS installer.  It included and will install for Python's use the current 
tcl/tk 8.6.x bugfix release.

import tkinter as tk
from tkinter import ttk
r = tk.Tk()
l = ttk.Label(r, text='colored label', background='red')
l.pack()
r.mainloop()  # if not in IDLE

We obviously should not remove something that works as intended on some systems.

--
components: +macOS
nosy: +ned.deily, ronaldoussoren, serhiy.storchaka, terry.reedy
title: ttk modules Label class does not respect background config option -> 
Tkinter ttk Label background ignored on MacOS
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



[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2018-04-27 Thread Tom Grigg

Change by Tom Grigg :


--
nosy: +tgrigg

___
Python tracker 

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



[issue33374] generate-posix-vars failed when building Python 2.7.14 on Linux

2018-04-27 Thread Tom Grigg

Change by Tom Grigg :


--
nosy: +fweimer

___
Python tracker 

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



[issue33374] generate-posix-vars failed when building Python 2.7.14 on Linux

2018-04-27 Thread Tom Grigg

Tom Grigg  added the comment:

I beleive this is caused by https://bugs.python.org/issue27987 in combination 
with GCC 8.

Florian Weimer proposed a patch which is included in the Fedora build:

https://src.fedoraproject.org/cgit/rpms/python2.git/tree/00293-fix-gc-alignment.patch

It would be nice if this was fixed for 2.7.15 so that it would build out of the 
box with GCC 8 on x86_64-linux-gnu.

--
nosy: +tgrigg

___
Python tracker 

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



[issue32857] tkinter after_cancel does not behave correctly when called with id=None

2018-04-27 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
pull_requests: +6316

___
Python tracker 

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



[issue33352] Windows: test_regrtest fails on installed Python

2018-04-27 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

On my system: py -3.n -m test.test_regrtest (or test test_regrtest) fails for n 
in {5, 6, 7}.  2.7 runs, but there are far fewer test methods. Repository 
builds work fine.

--
nosy: +terry.reedy
stage:  -> needs patch
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



[issue33351] Support compiling with clang-cl on Windows

2018-04-27 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
stage:  -> test needed

___
Python tracker 

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



[issue33347] zlibmodule undefined reference

2018-04-27 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +serhiy.storchaka, twouters
versions: +Python 3.8 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue33343] [argparse] Add subcommand abbreviations

2018-04-27 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I am closing this as a duplicate of #12713.  Paul, if you think that also 
should be closed, say so there if you have not done so yet.

--
nosy: +terry.reedy
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> argparse: allow abbreviation of sub commands by users
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue33341] python3 fails to build if directory or sysroot contains "*icc*" string

2018-04-27 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Thank you. Yes, we require a signed CA for something this non-trivial.

Victor, I don't know who maintains configure.  If you don't, maybe you know who 
does.

--
nosy: +terry.reedy, vstinner
stage:  -> patch review

___
Python tracker 

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



[issue33339] Using default encoding with `subprocess.run()` is not obvious

2018-04-27 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
stage:  -> needs patch
type:  -> enhancement
versions: +Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue24209] Allow IPv6 bind in http.server

2018-04-27 Thread Jason R. Coombs

Jason R. Coombs  added the comment:

>From what I can tell, there's not currently any tests for the behavior of 
>`http.server` as a script, and that sounds like a non-trivial behavior to 
>test. I agree documentation updates for this change are essential, but I'd 
>suggest a test is too high a burden to ask for a change like this when there 
>aren't already tests exercising the related functionality.

--

___
Python tracker 

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



[issue33336] [imaplib] MOVE is a legal command

2018-04-27 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
type:  -> enhancement
versions:  -Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue33335] turtle.onkey doesn't pass key information when key is None

2018-04-27 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
components: +Library (Lib) -Tkinter
nosy: +gregorlingl, willingc
stage:  -> test needed
type: behavior -> enhancement
versions:  -Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue33370] Addition of mypy cache to gitignore

2018-04-27 Thread Brett Cannon

Change by Brett Cannon :


--
type:  -> enhancement

___
Python tracker 

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



[issue33370] Addition of mypy cache to gitignore

2018-04-27 Thread Brett Cannon

Brett Cannon  added the comment:

Python's standard library isn't typed so running mypy on it isn't really 
beneficial at the moment. Plus you can add .mypy_cache to your global 
.gitignore file.

I'm not saying we can't add it, I'm just saying it isn't a priority.

--
nosy: +brett.cannon
priority: normal -> low

___
Python tracker 

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



[issue33327] Add a method to move messages to IMAPlib

2018-04-27 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
stage:  -> test needed
versions:  -Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue24209] Allow IPv6 bind in http.server

2018-04-27 Thread Jason R. Coombs

Change by Jason R. Coombs :


--
nosy: +jason.coombs

___
Python tracker 

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



[issue32608] Incompatibilities with the socketserver and multiprocessing packages

2018-04-27 Thread Michael Durso

Michael Durso  added the comment:

Hi Antoine, were you able to check out the pull request?  I'd like to get the 
issues resolved so the code can be merged into the next version.

Thanks!

--

___
Python tracker 

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



[issue33363] async for statement is not a syntax error in sync context

2018-04-27 Thread Zsolt Dollenstein

Change by Zsolt Dollenstein :


--
pull_requests: +6315

___
Python tracker 

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



[issue33369] Removing Popen log files in threads is racy on Windows

2018-04-27 Thread Peter Boström

Peter Boström  added the comment:

Wow that's old, yeah that's fair (I wouldn't expect this to be backported to 
any old releases).

Our current "workaround" is to try os.remove, sleep, repeat X times. This seems 
still racy and not something we'd like to have in our script if it can be 
resolved upstream. Retried on 2.7.15rc1:

C:\src>del *.log
Could Not Find C:\src\*.log

C:\src>C:\Python2.7.15rc1\python.exe --version
Python 2.7.15rc1

C:\src>C:\Python2.7.15rc1\python.exe racy_windows.py
Logging to 5656.log

Logging to 13068.log

Logging to 27620.log

Logging to 18384.log

Removing 5656.log

ERxception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Python2.7.15rc1\lib\threading.py", line 801, in __bootstrap_inner
self.run()
  File "C:\Python2.7.15rc1\lib\threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
  File "racy_windows.py", line 19, in __call__
os.remove(file_name)
WindowsError: [Error 32] The process cannot access the file because it is being 
used by another process: '5656.log'
emoving 13068.log
R
emoving 27620.log


Exception in thread Thread-3:
Traceback (most recent call last):
  File "C:\Python2.7.15rc1\lib\threading.py", line 801, in __bootstrap_inner
self.run()
  File "C:\Python2.7.15rc1\lib\threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
  File "racy_windows.py", line 19, in __call__
os.remove(file_name)
WindowsError: [Error 32] The process cannot access the file because it is being 
used by another process: '27620.log'
Exception in thread Thread-2:
Traceback (most recent call last):
  File "C:\Python2.7.15rc1\lib\threading.py", line 801, in __bootstrap_inner
self.run()
  File "C:\Python2.7.15rc1\lib\threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
  File "racy_windows.py", line 19, in __call__
os.remove(file_name)
WindowsError: [Error 32] The process cannot access the file because it is being 
used by another process: '13068.log'


Removing 18384.log

--

___
Python tracker 

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



[issue33337] Provide a supported Concrete Syntax Tree implementation in the standard library

2018-04-27 Thread Jakub Wilk

Change by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



[issue1692664] warnings.py gets filename wrong for eval/exec

2018-04-27 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

Thanks Guido, the new issue is #33375.

--

___
Python tracker 

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



[issue33375] warnings: get filename from frame.f_code.co_filename

2018-04-27 Thread Thomas Kluyver

New submission from Thomas Kluyver :

The warnings module tries to find and show the line of code which is 
responsible for a warning, for the same reasons that tracebacks show a line of 
code from each stack frame. However, they work in quite different ways.

Native tracebacks, the traceback module and pdb all do something like this:

frame.f_code.co_filename

But warnings does something like this (paraphrasing C code in _warnings.c):

frame.f_globals.get('__file__', sys.argv[0])

This causes problems for interactive interpreters like IPython, because there 
are multiple pieces of entered code which have to share the same global 
namespace. E.g. https://github.com/ipython/ipython/issues/11080

This was raised a long time ago in #1692664. Back then, the answer was that 
co_filename could be wrong if the path of a pyc file changed. However, that 
issue was fixed in #1180193. And it seems that the co_filename approach must 
largely work today, because tracebacks and pdb rely on it.

So I'm proposing to make warnings match how those other tools find filenames. I 
think this should also be a minor simplification of the code.

--
components: Library (Lib)
messages: 315848
nosy: takluyver
priority: normal
severity: normal
status: open
title: warnings: get filename from frame.f_code.co_filename

___
Python tracker 

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



[issue33363] async for statement is not a syntax error in sync context

2018-04-27 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset e2396506606115e785c94ec129eb86e2ed0aa744 by Yury Selivanov (Zsolt 
Dollenstein) in branch 'master':
bpo-33363: raise SyntaxError for async for/with outside async functions (#6616)
https://github.com/python/cpython/commit/e2396506606115e785c94ec129eb86e2ed0aa744


--

___
Python tracker 

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



[issue33374] generate-posix-vars failed when building Python 2.7.14 on Linux

2018-04-27 Thread Piotr Dobrogost

New submission from Piotr Dobrogost :

When building Python 2.7.14 on Fedora 28 I get the following error:

[piotr@demon]/tmp/Python-2.7.14% make
(…)
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
 echo "generate-posix-vars failed" ; \
 rm -f ./pybuilddir.txt ; \
 exit 1 ; \
fi
/bin/sh: line 5: 25857 Segmentation fault  (core dumped) ./python -E -S -m 
sysconfig --generate-posix-vars
generate-posix-vars failed
make[2]: *** [Makefile:514: pybuilddir.txt] Error 1
make[2]: Leaving directory '/tmp/Python-2.7.14'
make[1]: *** [Makefile:444: build_all_generate_profile] Error 2
make[1]: Leaving directory '/tmp/Python-2.7.14'
make: *** [Makefile:429: profile-opt] Error 2


Running problematic command alone I get this:

[piotr@demon]/tmp/Python-2.7.14% ./python -E -S -m sysconfig 
--generate-posix-vars
Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
zsh: segmentation fault (core dumped)  ./python -E -S -m sysconfig 
--generate-posix-vars

I found somehow related https://bugs.python.org/issue21166 with excellent 
explanation by Ned Deily (https://bugs.python.org/msg225217) but that issue is 
supposedly fixed.

I have Python 3.6.5 installed at /usr/bin/python3 and Python 2.7.14 installed 
at /usr/bin/python{2} – both from RPM packages.

I have Python 2.7.13 installed at /usr/local/bin/python{2} – built from source.

Running `which python` returns "/usr/local/bin/python".

Trying to isolate configuration and build by prefixing commands with
PATH=/usr/bin:/usr/sbin LIBRARY_PATH= LD_LIBRARY_PATH= (…)
does not help.

--
components: Build
messages: 315846
nosy: ned.deily, piotr.dobrogost
priority: normal
severity: normal
status: open
title: generate-posix-vars failed when building Python 2.7.14 on Linux
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



[issue1692664] warnings.py gets filename wrong for eval/exec

2018-04-27 Thread Guido van Rossum

Guido van Rossum  added the comment:

I recommend opening a new issue (you can link to this one for past discussion).

--

___
Python tracker 

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



[issue33373] ttk modules Label class does not respect background config option

2018-04-27 Thread C.D. MacEachern

New submission from C.D. MacEachern :

Python tkinter.ttk.Label instance is not respecting background configuration.

I'm running 3.6.5 64-bit python with Tk 8.6 on OS X 10.13.4.

Here is an output of an interactive session to demonstrate the steps. Notice 
that the ttk.Label keys() output shows that the ‘background’ config option is 
supported. Additionally, the ttk::label manual page 
(http://www.tcl.tk/man/tcl8.6/TkCmd/ttk_label.htm#M6) shows that the 
‘-background’ option is an available ‘widget-specific option’. 


[~/projects/parou/src (2.0)] $ python3
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter as tk
>>> import tkinter.ttk as ttk
>>> root = tk.Tk()
>>> tk_label = tk.Label(root)
>>> tk_label.keys()
['activebackground', 'activeforeground', 'anchor', 'background', 'bd', 'bg', 
'bitmap', 'borderwidth', 'compound', 'cursor', 'disabledforeground', 'fg', 
'font', 'foreground', 'height', 'highlightbackground', 'highlightcolor', 
'highlightthickness', 'image', 'justify', 'padx', 'pady', 'relief', 'state', 
'takefocus', 'text', 'textvariable', 'underline', 'width', 'wraplength']
>>> tk_label.config(text='Old style tkinter.Label instance', foreground='blue', 
>>> background='red')
>>> tk_label.pack()
>>> new_ttk_label = ttk.Label(root)
>>> new_ttk_label.keys()
['background', 'foreground', 'font', 'borderwidth', 'relief', 'anchor', 
'justify', 'wraplength', 'takefocus', 'text', 'textvariable', 'underline', 
'width', 'image', 'compound', 'padding', 'state', 'cursor', 'style', 'class']
>>> new_ttk_label.config(text='New tkinter.ttk.Label instance', 
>>> foreground='blue', background='blue')
>>> new_ttk_label.pack()
>>> tk_label.config('background')
('background', 'background', 'Background', , 'red')
>>> new_ttk_label.config('background')
('background', 'frameColor', 'FrameColor', '', )
>>> new_ttk_label.config('foreground')
('foreground', 'textColor', 'TextColor', '', )
>>> root.mainloop()

I would expect the background to change colour on the ttk Label the same way it 
does when I change the background on the tkinter.Label instance.

It appears to not have worked as documented since 2014 for some, so my 
suggestion would be to remove 'background' as an option exposed in 
ttk.Label().keys().

Link to SO thread where it is discussed as well:

https://stackoverflow.com/questions/23750141/tkinter-ttk-widgets-ignoring-background-color/50064376#50064376

--
components: Tkinter
messages: 315844
nosy: cmaceachern
priority: normal
severity: normal
status: open
title: ttk modules Label class does not respect background config option
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



[issue33361] readline() + seek() on io.EncodedFile breaks next readline()

2018-04-27 Thread Elena Oat

Elena Oat  added the comment:

I've modified a little your example and it's clearly that the readline moves 
the cursor.

```
from __future__ import print_function

import codecs
import io


def run(stream):
offset = stream.tell()
try:
stream.seek(0)
header_row = stream.readline()
finally:
stream.seek(offset)
print(offset)
print(stream.tell())
print('Got header: %r' % header_row)

if stream.tell() == 0:
print(stream.tell())
print(stream.readline())
print('Skipping the header: %r' % stream.readline())

for index, line in enumerate(stream, start=2):
print('Line %d: %r' % (index, line))


b = io.BytesIO(u'ab\r\ncd\ndef\n'.encode('utf-16-le'))
s = codecs.EncodedFile(b, 'utf-8', 'utf-16-le')
run(s)

```
The first call to readline returns cd instead of ab.

--

___
Python tracker 

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



[issue1692664] warnings.py gets filename wrong for eval/exec

2018-04-27 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

Time for some bug archaeology!

The reason given for not using frame.f_code.co_filename for warnings was that 
it can be wrong when the path of .pyc files changes. However, it looks like 
that was fixed in #1180193 (thanks for the pointer zseil), so I'd like this 
idea to be reconsidered.

Python uses frame.f_code.co_filename for tracebacks and in pdb, so it's 
counterintuitive that the warnings module works differently. They are all 
trying to do the same thing: find and show the bit of code that you're 
interested in.

This causes problems in IPython with warnings attributed to interactive code: 
warnings sees it all as part of the __main__ module, so we can't distinguish 
which input it's pointing to (it's usually obvious, but still...). We have 
integrated with linecache to make tracebacks work, and I think that if warnings 
used code.co_filename, it would also work as expected.

--
nosy: +takluyver

___
Python tracker 

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



[issue33361] readline() + seek() on io.EncodedFile breaks next readline()

2018-04-27 Thread Elena Oat

Elena Oat  added the comment:

For you specific example I get also a weird result. Tried this in Python 2.7.10 
and Python 3.6.0.

--

___
Python tracker 

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



[issue31727] FTP_TLS errors when use certain subcommands

2018-04-27 Thread Matthieu Pepin

Matthieu Pepin  added the comment:

I can confirm. I'm having the exact same issue in Python 3.6.5.

--
nosy: +Matthieu Pepin

___
Python tracker 

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



[issue33358] [EASY] x86 Ubuntu Shared 3.x: test_embed.test_pre_initialization_sys_options() fails

2018-04-27 Thread miss-islington

miss-islington  added the comment:


New changeset dd3ede7537653a62815c2fedbb67d6f2fb870d4c by Miss Islington (bot) 
in branch '3.7':
bpo-33358: Fix test_embed.test_pre_initialization_sys_options (GH-6612)
https://github.com/python/cpython/commit/dd3ede7537653a62815c2fedbb67d6f2fb870d4c


--
nosy: +miss-islington

___
Python tracker 

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



[issue33041] Issues with "async for"

2018-04-27 Thread STINNER Victor

STINNER Victor  added the comment:

I didn't check if the new warning, fixed by my PR-6595 in the master branch, 
exists on Windows in 3.6 and 3.7. If it does, you might want to request a 
backport of my PR. Usually, I only fix compiler warnings in the master branch.

--

___
Python tracker 

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



[issue33041] Issues with "async for"

2018-04-27 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 078c4e3519deeef8014541925da057bb064eb5a8 by Victor Stinner in 
branch 'master':
bpo-33041: Fix downcast warning on Windows (#6595)
https://github.com/python/cpython/commit/078c4e3519deeef8014541925da057bb064eb5a8


--
nosy: +vstinner

___
Python tracker 

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



[issue33358] [EASY] x86 Ubuntu Shared 3.x: test_embed.test_pre_initialization_sys_options() fails

2018-04-27 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6314

___
Python tracker 

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



[issue33358] [EASY] x86 Ubuntu Shared 3.x: test_embed.test_pre_initialization_sys_options() fails

2018-04-27 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 4114846265536344538ae44cb8ffd8ce2903faf7 by Victor Stinner (Pablo 
Galindo) in branch 'master':
bpo-33358: Fix test_embed.test_pre_initialization_sys_options (GH-6612)
https://github.com/python/cpython/commit/4114846265536344538ae44cb8ffd8ce2903faf7


--

___
Python tracker 

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



[issue33361] readline() + seek() on io.EncodedFile breaks next readline()

2018-04-27 Thread Elena Oat

Elena Oat  added the comment:

I've tried this with Python 3.6.0 on OSX 10.13.4

--

___
Python tracker 

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



[issue27277] Fatal Python error: Segmentation fault in test_exceptions

2018-04-27 Thread STINNER Victor

STINNER Victor  added the comment:

> It was encountered recently while building Python 3.6 under CentOS 6 [0] and 
> the way to fix it was to increase the maximum stack size using ulimit e.g. [1]

In a perfect world, unit tests should not depend on the environment. So Python 
may *try* to increase the maximum stack size when running these tests. (If the 
limit cannot be increased, it's fine.)

--
nosy: +vstinner

___
Python tracker 

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



[issue27277] Fatal Python error: Segmentation fault in test_exceptions

2018-04-27 Thread Charalampos Stratakis

Charalampos Stratakis  added the comment:

This is an issue with the stack size.

It was encountered recently while building Python 3.6 under CentOS 6 [0] and 
the way to fix it was to increase the maximum stack size using ulimit e.g. [1]

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1572150
[1] https://src.fedoraproject.org/rpms/python3/blob/f26/f/python3.spec#_1132

--
nosy: +cstratak

___
Python tracker 

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



[issue29652] Fix evaluation order of keys/values in dict comprehensions

2018-04-27 Thread Nick Coghlan

Nick Coghlan  added the comment:

The current discrepancy is odd when you compare it to the equivalent generator 
expression:

{k:v for k, v in iterable}

dict(((k, v) for k, v in iterable))

It would never have occurred to me to expect the evaluation order to match a 
fully unrolled loop with a nested "d[k] = v" assignment, because the dict 
constructor doesn't work that way - it accepts an iterable of 2-tuples.

PEP 274 also specifies the iterable-of-2-tuples interpretation (using a list 
comprehension as its baseline rather than a generator expression): 
https://www.python.org/dev/peps/pep-0274/#semantics

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



[issue33366] `contextvars` documentation incorrectly refers to "non-local state".

2018-04-27 Thread Tom Christie

Tom Christie  added the comment:

Refs: https://github.com/python/cpython/pull/6617

--

___
Python tracker 

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



[issue33366] `contextvars` documentation incorrectly refers to "non-local state".

2018-04-27 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



[issue33372] Wrong calculation

2018-04-27 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Ah sheesh I copied and pasted the wrong bits. After the division terms go to 
zero, you get

-590072-200112-18-18-18-18-18-18-18-18+9998599835

which goes to 9997809507 as calculated by Ruby and Python 2, and I promise 
that's the end of me replying to myself :-)

--

___
Python tracker 

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



[issue33372] Wrong calculation

2018-04-27 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

> Even Ruby gets the right answer (9997809507) for that :-)

Oops, I forgot to say... Ruby 1.8 also does truncating division like Python 2.

--

___
Python tracker 

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



[issue33372] Wrong calculation

2018-04-27 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

I agree with Tim that this is likely to be the difference between Python 2 
truncating division and Python 3 division.

For the record, I get the following results:

9997809507L Python 2.7
9997809307.0 Python 3.5
9997809307 R
9997809307 Javascript (Rhino)
9997809307 OpenXion

I tried it in Ruby 1.8 as well, and sometimes got a syntax error and sometimes 
599931. I have no idea why the odd results.

I'm not mad enough to type the whole thing into my calculator, but I am mad 
enough to simplify it by hand, and I get:

-590072-2/10*100-200112-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100+9998599835

Even Ruby gets the right answer (9997809507) for that :-)

In Python 2, 2/10 returns 0 unless you have run `from __future__ import 
division`, so the -2/10*100 terms all go to zero, and we get:

-590072-2/10*100-200112-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100-18-2/10*100+9998599835

which evaluates to 9997809307.0 just as Python 2.7 says.

So Tim was right, this is entirely due to the difference between / as 
truncating division in Python 2 and true division in Python 3.

Oh, and one last thing... in Python 2, you can get the expected result by 
either using the future import above, or by adding a decimal point to the 
numbers being divided, turning them into floats and forcing Python to use 
floating point true division.

--
nosy: +steven.daprano

___
Python tracker 

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