[issue24899] Add an os.path = pathlib equivalence table in pathlib docs

2015-08-20 Thread Ezio Melotti

New submission from Ezio Melotti:

I think it would be useful to add to the pathlib documentation a table listing 
os/os.path operations and their pathlib equivalent.
This will be useful both for people porting their code to pathlib and for 
people that already know os/os.path and want to get familiar with pathlib.

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 248877
nosy: docs@python, ezio.melotti, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Add an os.path = pathlib equivalence table in pathlib docs
type: enhancement
versions: Python 3.4, Python 3.5, Python 3.6

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



[issue24294] DeprecationWarnings should be visible by default in the interactive REPL

2015-08-20 Thread Nathaniel Smith

Nathaniel Smith added the comment:

I don't see how any of those suggestions help for writing an automated test. 
Spawning a shell is irrelevant; the problem is to get a tty, which is much 
harder. There only way I can see that might work for an automated test is to use
  https://docs.python.org/3/library/pty.html
which is Linux only, but I suppose that's better than nothing.

(isatty(sys.stdin) does do something sensible on Windows, right? I hope?)

--

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



[issue24903] Do not verify destdir argument to compileall

2015-08-20 Thread Jake Garver

New submission from Jake Garver:

In compileall.py's main, we verify that the provided destdir (-d) exists at 
build time.  But destdir will commonly be used to override the build time path 
with a runtime path.  That runtime path will usually not exist at build time.

Note that this logic was changed when compileall.py was migrated to argparse.  
I think the old logic accidentally avoided the isdir() check at build time.
https://github.com/python/cpython/commit/11e99b06bda2a23478fcec40df8c18edc8a06668

With the attached patch, behavior is made consistent with python 2.7, intended 
or otherwise.

--
components: Library (Lib)
files: python34_compileall_ddir.diff
keywords: patch
messages: 248900
nosy: jgarver
priority: normal
severity: normal
status: open
title: Do not verify destdir argument to compileall
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file40216/python34_compileall_ddir.diff

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



[issue24294] DeprecationWarnings should be visible by default in the interactive REPL

2015-08-20 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

Would `pty` even work on CI where the terminal itself might not be a TTY ?

 subprocess.Popen(['bash', '-c', '''./python.exe -c import sys; 
print(sys.stdin.isatty())'''], stdin=subprocess.PIPE, stderr=subprocess.STDOUT)

False

Otherwise, I can also (try to) implement  a debug flag 
--FakeTTYYesIMReallySure that make `.isatty()` lie.

--

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



[issue24900] Raising an exception that cannot be unpickled causes hang in ProcessPoolExecutor

2015-08-20 Thread Benedikt Sauer

Benedikt Sauer added the comment:

Actually I think that this may consist of multiple issues:

1. http://bugs.python.org/issue8323 (closed as wont-fix): multiprocessing.Queue 
should throw a sensible error if a Queue element can't be unpickled, however 
the user managed to create that
2. The worker process should prevent unpicklable ResultItems to be put on the 
Queue
3. The parent thread in ProcessPoolExecutor should handle the exceptions by 
setting its broken flag and at least trying to cleanly shut down

--
title: Raising an exception that is unable to be unpickled causes hang in 
ProcessPoolExecutor - Raising an exception that cannot be unpickled causes 
hang in ProcessPoolExecutor

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



[issue24900] Raising an exception that is unable to be unpickled causes hang in ProcessPoolExecutor

2015-08-20 Thread Benedikt Sauer

New submission from Benedikt Sauer:

When raising an exception that is unpicklable in a worker process. This used to 
be the case for all exceptions that have a non-trivial constructor but this was 
fixed by http://bugs.python.org/issue1692335.

I now have the concrete problem with cx_Oracle in which the error type 
cx_Oracle._Error doesn't define tp_new which results in a

UnpicklingError: NEWOBJ class argument has NULL tp_new

I have already reported this fact at 
https://bitbucket.org/anthony_tuininga/cx_oracle/issues/23.

However, I think that the worker thread should either be able to recover from 
this (which should be quite easy) or, at the very least, fail cleanly. 
Currently, when this condition is triggered the worker processes are not killed 
alongside the parent.

There is an existing report and a patch in the backports project: 
https://github.com/agronholm/pythonfutures/issues/30#issuecomment-132576545

--
messages: 248878
nosy: filmor
priority: normal
severity: normal
status: open
title: Raising an exception that is unable to be unpickled causes hang in 
ProcessPoolExecutor
versions: Python 3.3

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



[issue24880] ctypeslib patch for regular expression for symbols to include

2015-08-20 Thread Jan Wagner

Jan Wagner added the comment:

Yes, hosted at svn.python.org, but without any means of externally filing a 
bug report or patch for it other than here on bugs.python.org. Maybe theller 
you could include this patch?   Change status to closed + third party...?

--

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



[issue24902] http.server: on startup, show host/port as URL

2015-08-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FWIW, I like Felix's original suggestion.

--
nosy: +rhettinger

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



[issue24904] Patch: add timeout to difflib SequenceMatcher ratio() and quick_ratio()

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

So - I'm with Victor and Raymond here. I think modifying difflib to provide 
external control over the poor-O components would permit many more benefits 
than just controlling time: you could wrap them in a timer module to get what 
this patch does, you could replace them with alternative implementations (e.g. 
parallel ones).

--
nosy: +rbcollins

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



[issue14534] Add means to mark unittest.TestCases as do not run.

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

So I've two more cases for this that I think we need to ensure works.

Firstly FunctionTestCase should be blacklistable, and its not abstract.

Secondly we're going to want nose, unittest2 etc to be able to also honour 
this. I suspect that this is easy and may not require any changes, but having a 
think about it would be good.

--
nosy: +rbcollins
title: Add method to mark unittest.TestCases as do not run. - Add means to 
mark unittest.TestCases as do not run.

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



[issue24901] single element tuple 's ending comma is different that without comma

2015-08-20 Thread shiva prasanth

New submission from shiva prasanth:

Python 2.7.9 (default, Apr  2 2015, 15:33:21) 
[GCC 4.9.2] on linux2
Type help, copyright, credits or license for more information.
 (2,)==(2)
False
 (2,3,)==(2,3)
True
 (2,3)==(2,3,)
True
 s=(2,)
 s2=(2)
 s==s2
False


--
messages: 248880
nosy: shivaprasanth
priority: normal
severity: normal
status: open
title: single element tuple 's ending comma is different that without comma
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue24901] (2, )!=(2) and (2, 3)==(2, 3, ) why ??? tested in each version

2015-08-20 Thread shiva prasanth

Changes by shiva prasanth kesavarapu.s...@gmail.com:


--
nosy:  -shivaprasanth
title: single element tuple 's ending comma is different that without comma - 
(2,)!=(2) and (2,3)==(2,3,) why ??? tested in each version
type:  - behavior
versions: +Python 3.4

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



[issue24901] (2, )!=(2) and (2, 3)==(2, 3, ) why ??? tested in each version

2015-08-20 Thread eryksun

eryksun added the comment:

Refer to section 6.2.3, parenthesized forms:

https://docs.python.org/3/reference/expressions.html#parenthesized-forms

if the list contains at least one comma, it yields a tuple;
otherwise, it yields the single expression that makes up the
expression list.

So (2) is an int, while (2,) is a tuple that contains an int.

The exception is the empty tuple, for which parentheses are
required — allowing unparenthesized “nothing” in 
expressions would cause ambiguities and allow common typos
to pass uncaught.

Thus () is an empty tuple. Note also that section 6.13 states the following 
regarding a trailing comma:

The trailing comma is required only to create a single 
tuple (a.k.a. a singleton); it is optional in all other 
cases.

--
nosy: +eryksun
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue22680] Blacklist FunctionTestCase from test discovery

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

Thanks for this. I think that a better approach would be the other linked bug - 
we can kill many birds with one stone.

--
resolution:  - duplicate
status: open - closed

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



[issue24790] Idle: improve stack viewer

2015-08-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I just realized that there is a slight but in the patch so far.  When a 
non-empty program runs, it necessarily executes at least one statement in the 
main module.  It will only execute anything else when there is a call. 
Therefore, the stack trace always begins in the main module and that line can 
be used to display globals, making the globals item under functions redundant.

However, if there is a call to a function in another module, there need not be 
a module level statement.  By removing the globals items for functions in other 
modules, the current patch as is will not allow viewing of globals in other 
modules. A possible solution is to add an expandable module item every time the 
module changes.

Mark and I would like to combine the StackViewer and Debugger UIs.  
Essentially, a revised stackviewer pane would eventually become part of the 
debugger.  The Debugger avoids the intermediate +locals and +globals items of 
StackViewer by expanding both when an item is clicked.  However, the expansion 
is not added to the tree, but to the one locals box and the one (optional) 
globals box, both separate from and below the tree.

An alternate solution to the globals problem is to expand locals under a 
function when clicked on, as currently done with stackviewer, and expand 
globals to a globals box below the tree, as currently done with stackviewer.  I 
do not see much need to see the globals of different functions simultaneously 
(one can switch, as one must do not with Debugger).  I see more reason to see 
multiple locals of at the same time, and it also make sense to put locals right 
under each function.

Debugger already does item 8.

--

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



[issue22197] Allow better verbosity / output control in test cases

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

There's a few interacting things here. If I can suggest some design thoughts.

buffering within a test is I think really something we should offer a test 
servicing API for. There are many thirdparty ones (e.g. I have one in fixtures) 
- but it should be a dedicated API, even if the implementation happens to be 
shared with the buffer runner feature.

I think it is reasonable in some cases to change TestCase behaviour based on 
how much debugging is desired - even in CI environments, some outputs are much 
more expensive than others to generate (e.g. taking a full dump of a database). 
To enable that we do need a CLI - runtime environment communication mechanism.

There are many related APIs which we could look at for doing this.
* TestCase's load API (__init__) - we'd get at this via TestLoader
* TestCase's execution API (run, debug) - we'd get at this through TestRunner 
(for more parameters) or perhaps TestResult (by adding some attribute/query 
method).
* TestCase's test servicing API (assert*) - we could add a query method or a 
well known attribute to abstract out where the info is actually coming from
* TestCase's user supplied API (setUp, test methods)
* TestResult - constructed by the runner, it is in some ways the natural means 
for passing stuff like this around - its how result does its buffering today: 
but IMO the implementation is in the wrong spot there [it precludes 
parallelisation vs a test service API that uses a mutex only when needed], so 
I'd like to not repeat that here.

TestCases support being run multiple times, so to me that rules out using the 
load API.

I very much want to take TestResult in the direction of being forward-only: 
feed-backwards APIs on it are much more complex to reason about in the case of 
Y joins in the result chain. So I think its time we introduced a runner - test 
API.

Something like

def run(self, result=None, runner=None):
   ...
   dunder_set(self, '__unittest__runner__', runner)
   try:
   ...
   finally:
   dunder_set(self, '__unittest__runner__', None)
   
def debug(self, runner=None):
   ... same ...

with a helper to pull that out without folk's own code triggering name mangling.

And runner would then be the home for things like aborting a test run, 
providing configuration like verbosity, arbitrary end user options and so on.
Something like:
runner.config = {}
runner.config['verbosity'] = ...
runner.config['user'] = {... marshalled from CLI ... }

--

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



[issue14534] Add means to mark unittest.TestCases as do not load.

2015-08-20 Thread Robert Collins

Changes by Robert Collins robe...@robertcollins.net:


--
title: Add means to mark unittest.TestCases as do not run. - Add means to 
mark unittest.TestCases as do not load.

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



[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2015-08-20 Thread Shiming He

Changes by Shiming He heshim...@gmail.com:


--
nosy: +Shiming He

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



[issue14534] Add means to mark unittest.TestCases as do not run.

2015-08-20 Thread Robert Collins

Changes by Robert Collins robe...@robertcollins.net:


Removed file: http://bugs.python.org/file36315/01438f18ee18.diff

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



[issue14534] Add means to mark unittest.TestCases as do not run.

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

Removed the bogus huge diff.

--

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



[issue24263] unittest cannot load module whose name starts with Unicode

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

I'm torn on whether this needs a test or not. It would be hard to regress, but 
testing this properly really wants hypothesis with a 
valid-python-identifier-strategy.

I think on balance we do need one.

So - we need a test in test_discover that mocks the presence of a file with a 
name containing e.g. \u2603.

--
stage:  - patch review

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



[issue14534] Add means to mark unittest.TestCases as do not run.

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

I'm going to review on rietvald - I see a lot of changes needed - sorry - and 
some are a bit bikesheddy. But, if we do them I'll commit it asap and do any 
final fixup needed.

--

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



[issue24352] Provide a way for assertLogs to optionally not hide the logging output

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

Ok so, design thoughts here.

assertLogs really does two things. Firstly it takes a copy of the logs so it 
can do its assertion.

Secondly it disables all other logging, cleaning up noisy tests.

Your specific need only conflicts with the second case.

The way I handle this in 'fixtures' is to automatically attach the logs to the 
test output, which means failures show the logs. (Successes have them too, but 
they are not shown by default).

Ignoring the mismatch between stock unittest and fixtures supporting unittests, 
does this sound like it would meet your needs? e.g. you'd use your global to 
make attachments be shown on success as well as failure, and then you'd have 
nearly identical behaviour. But not exactly:  it would still disable the 
during-execution output (which makes parallel and CI runs a lot nicer - the 
report at the end is the key).

--

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



[issue24790] Idle: improve stack viewer

2015-08-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

We should take a look as the stackviewer part of the debugger ui.

--

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



[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

(for the trivial case of CLI discover without a parameter - so translate that 
to the lower level API and then test that)

--

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



[issue23882] unittest discovery doesn't detect namespace packages when given no parameters

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

reviewed in rietvald, but here too just in case.

The hunk that saves/restores _top_level_dir feels wrong to me - and not part of 
this bug, please remove it.

The rest of the patch is fine today.

But it also needs to add two specifically namespace tests: concretely we need 
the following cases covered:


a) namespace subdir/namespace subdir/test_foo.py gets loaded
b) namespace subdir/test_foo.py with another instance of the namespace subdir 
on sys.path also containing e.g. test_bar.py, test_bar.py is not loaded.

--

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



[issue24900] Raising an exception that cannot be unpickled causes hang in ProcessPoolExecutor

2015-08-20 Thread Alex Grönholm

Changes by Alex Grönholm alex.gronholm+pyt...@nextday.fi:


--
nosy: +alex.gronholm

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



[issue24247] unittest discover modifies sys.path

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

It did that because you did not specify a top level directory. Without that, 
the cwd is not on the path and that breaks many environments.

We should probably document it better. The workaround for your needs is to 
either just run 'unittest discover', or run 'unittest discover tests -t .', not 
'unittest discover tests'.

The behaviour is however something I believe to be correct and essential to 
most user experiences.

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python
stage:  - needs patch
title: unittest discover does modify sys.path - unittest discover modifies 
sys.path

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



[issue24355] Provide a unittest api for controlling verbosity in tests

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

I've put a fairly comprehensive comment into issue22197.

--

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



[issue24758] unittest.mock.Mock's new unsafe feature needs a better error message

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

@Randy - ok thanks. So, please do improve the prose in the error message, 
should be a very straight forward patch.

--
stage: test needed - needs patch

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



[issue24781] Improve UX of IDLE Highlighting configuration tab

2015-08-20 Thread Mark Roseman

Mark Roseman added the comment:

Regarding the setting background for the multiple elements.. one possibility is 
that the first time in a session they change the background of an element that 
was same as the background, we ask if they'd like to apply that change to the 
other program elements that have the same background.

I hope that wouldn't be too You seem to be writing a letter... :-)

--

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



[issue24383] consider implementing __await__ on concurrent.futures.Future

2015-08-20 Thread Alex Grönholm

Alex Grönholm added the comment:

I've implemented my background-calling code in my framework via 
run_in_executor() now, so this has become a non-issue for me. I have no more 
interest in this patch.

--

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



[issue24305] The new import system makes it impossible to correctly issue a deprecation warning for a module

2015-08-20 Thread Eric Snow

Eric Snow added the comment:

Hybrid Nathaniel/Brett approach LGTM

--

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



[issue23496] Steps for Android Native Build of Python 3.4.2

2015-08-20 Thread Russell Keith-Magee

Russell Keith-Magee added the comment:

What hardware architecture are you compiling for? If it's ARM64, and you're 
not using a trunk version of libffi, that segfault in test_ctypes is to be 
expected.

 Does this mean I can safely ignore the segfault?

Well, safely in the sense that everything except a very recent version of 
libffi is known to not work on ARM64 - so if it doesn't work, it's not because 
of something Python is doing wrong, it's a problem with a dependency.

Are you using the libffi sources vendored into the Python source tree, or a 
more recent version? 

By 'vendored in' do you mean 'sources included in python source tree for 
building?'

Correct. The libffi source code that is in the Python source tree is quite old, 
and *definitely* doesn't work on ARM64. I'm not even sure that it works on 
ARMv7.

I can verify that libffi v3.2 works on ARMv7 (on iOS, anyway), and there's 
been plenty of changes to the ARM source tree since the Python version was 
vendored in.

 Would your recommend downloading and building libffi from sources (on device) 
 and then building python?

Well, for starters - as I've said before, I'd recommend not compiling on device 
at all, but that's a separate issue. 

However, regardless of where you're compiling, you can either use an external 
libffi, or you can do what I've done in the iOS patch - update the Python 
source tree to include a newer version of libffi. If you update the source in 
the Python tree, you need to use 2 versions (or a merged version); you need 
v3.2 sources for ARMv7, and trunk sources for ARM64. This is because libffi 
v3.2 doesn't work for ARM64, and trunk doesn't even compile for ARMv7. See the 
iOS patch for details.

 I'm asking the above questions because I've hit a fairly significant 
 roadblock; I'm still getting the segfault when test_ctypes is run and I can't 
 seem to get anything useful out of gdb.

Personally, I've pretty much given up on CPython on Android. Even when I got it 
working, the performance of the JNI layer is *abysmal*, and severely crippled. 
If you're planning to actually interact with the device in any way (like, say, 
put a button on the screen), that's a big problem. 

I'm working on an approach that uses Java natively - think Jython for 
Android. I'm still a way off having anything working, though.

--

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



[issue24904] Patch: add timeout to difflib SequenceMatcher ratio() and quick_ratio()

2015-08-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

In general, it isn't good design to incorporate timeout logic in computation 
logic.  What would be better is a general purpose, reusable, decoupled tool: 
run_with_time_limit(some_computation, some_args, time_limit).  Such a tool 
might be based on separate process that can be timed or killed, it might use 
signals, or may be based on threading.Timer.

I did a quick look around the net.  Timeouts on diff APIs aren't common (i.e 
GNU diff doesn't have a timeout) but there are a couple of precedents (you 
aren't the first to have had concerns about the running time for unfavorable 
inputs).

--
nosy: +rhettinger

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



[issue24904] Patch: add timeout to difflib SequenceMatcher ratio() and quick_ratio()

2015-08-20 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
nosy: +tim.peters

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



[issue24263] unittest cannot load module whose name starts with Unicode

2015-08-20 Thread Robert Collins

Robert Collins added the comment:

Thank you very much for writing your patch in backwards compatible style - it 
will make backporting to unittest2 much easier.

--

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



[issue23517] datetime.utcfromtimestamp parses timestamps incorrectly

2015-08-20 Thread Tim Peters

Tim Peters added the comment:

It is really bad that roundtripping current microsecond datetimes doesn't work. 
 About half of all microsecond-resolution datetimes fail to roundtrip correctly 
now.  While the limited precision of a C double guarantees roundtripping of 
microsecond datetimes far enough in the future will necessarily fail, that 
point is about 200 years from now.

Rather than argue endlessly about rounding, it's possible instead to make the 
tiniest possible change to the timestamp _produced_ at the start.  Here's code 
explaining it:

ts = d.timestamp()
# Will microseconds roundtrip correctly?  For times far
# enough in the future, there aren't enough bits in a C
# double for that to always work.  But for years through
# about 2241, there are enough bits.  How does it fail
# before then?  Very few microsecond datetimes are exactly
# representable as a binary float.  About half the time, the
# closest representable binary float is a tiny bit less than
# the decimal value, and that causes truncating 1e6 times
# the fraction to be 1 less than the original microsecond
# value.
if int((ts - int(ts)) * 1e6) != d.microsecond:
# Roundtripping fails.  Add 1 ulp to the timestamp (the
# tiniest possible change) and see whether that repairs
# it.  It's enough of a change until doubles just plain
# run out of enough bits.
mant, exp = math.frexp(ts)
ulp = math.ldexp(0.5, exp - 52)
ts2 = ts + ulp
if int((ts2 - int(ts2)) * 1e6) == d.microsecond:
ts = ts2
else:
# The date is so late in time that a C double's 53
# bits of precision aren't sufficient to represent
# microseconds faithfully.  Leave the original
# timestamp alone.
pass
# Now ts exactly reproduces the original datetime,
# if that's at all possible.

This assumes timestamps are = 0, and that C doubles have 53 bits of precision. 
 Note that because a change of 1 ulp is the smallest possible change for a C 
double, this cannot make closest-possible unequal datetimes produce 
out-of-order after-adjustment timestamps.

And, yes, this sucks ;-)  But it's far better than having half of timestamps 
fail to convert back for the next two centuries.  Alas, it does nothing to get 
the intended datetime from a microsecond-resolution timestamp produced 
_outside_ of Python.  That requires rounding timestamps on input - which would 
be a better approach.

Whatever theoretical problems may exist with rounding, the change to use 
truncation here is causing real problems now.  Practicality beats purity.

--
nosy: +tim.peters

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



[issue24294] DeprecationWarnings should be visible by default in the interactive REPL

2015-08-20 Thread Nathaniel Smith

Nathaniel Smith added the comment:

If pty is going to work at all then it should work regardless of whether the 
tests themselves are being run under a tty, yes.

I personally would not want to merge a test based on making isatty lie, because 
the point of tests is to increase confidence that things work, and that test 
sounds more complicated and error prone than the original code being tested. 
I'm not a cpython committer though...

I am more concerned that isatty might actually just not work on windows, since 
it is actually strictly speaking true that you never have a try on Windows, 
even if you might have a gui console window open. It would be a good idea to 
check this quickly...

The other option would be to just remove the isatty check from the patch 
entirely -- it wasn't something that had strong consensus in the first place.

--

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



[issue24897] Add new attribute decorator (akin to property)?

2015-08-20 Thread Eric Snow

Eric Snow added the comment:

That said...

What's the benefit of it being a decorator?  The docstring?  Access to 
func.__name__?  It could just as well be:

class attribute:
_name = None
def __get__(self, instance, owner):
if instance is None:
return self
if self._name is None:
for name, attr in vars(owner).items():
if attr is self:
self._name = name
break
return instance.__dict__[self._name]

However, note that this is a non-data descriptor since it lacks __set__ and 
__delete__.  That means it is *not* a read-only wrapper like property.  If 
that's not a concern then there's no point to using a descriptor at all since 
you can just use a constant as a place-holder:

class Bar:
x = ...
def __init__(self):
self.x = 42

If you *are* looking for a read-only wrapping descriptor then you'll need 
__set__ and __delete__ methods, likely ones that simply raise AttributeError.

FWIW, there are definitely plenty of useful things you can do with descriptors. 
[1]  Some could be useful enough to make it into the stdlib (or builtins), but 
I'm not convinced the one you are proposing has enough justification at this 
point.

[1] 
https://bitbucket.org/ericsnowcurrently/presentations/src/default/utpy-may2015/

--

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



[issue23496] Steps for Android Native Build of Python 3.4.2

2015-08-20 Thread Cyd Haselton

Cyd Haselton added the comment:

A few questions for Russell:

What hardware architecture are you compiling for? If it's ARM64, and you're 
not using a trunk version of libffi, that segfault in test_ctypes is to be 
expected.

Does this mean I can safely ignore the segfault?

Are you using the libffi sources vendored into the Python source tree, or a 
more recent version? 

By 'vendored in' do you mean 'sources included in python source tree for 
building?'

I can verify that libffi v3.2 works on ARMv7 (on iOS, anyway), and there's 
been plenty of changes to the ARM source tree since the Python version was 
vendored in.

Would your recommend downloading and building libffi from sources (on device) 
and then building python?

I'm asking the above questions because I've hit a fairly significant roadblock; 
I'm still getting the segfault when test_ctypes is run and I can't seem to get 
anything useful out of gdb.

--

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



[issue24897] Add new attribute decorator (akin to property)?

2015-08-20 Thread Emanuel Barry

Emanuel Barry added the comment:

I figured. I guess it makes more sense to do that on a per-library basis. Eric 
does have a valid point, and perhaps this addition is not needed :) I realize 
now that this isn't really needed, backing off and closing :)

--

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



[issue21253] unittest assertSequenceEqual can lead to Difflib.compare() crashing on mostly different sequences

2015-08-20 Thread John Taylor

John Taylor added the comment:

I am seeing something similar in difflib.HtmlDiff.make_file() under Python 
3.4.3 (windows 7).  Do I need to file a separate bug report?


File H:\test\test.py, line 522, in print_differ
diff = html.make_file(file1_data,file2_data,dir 1,dir 2,True)
  File C:\Python34\lib\difflib.py, line 1713, in make_file
context=context,numlines=numlines))
  File C:\Python34\lib\difflib.py, line 1962, in make_table
fromlist,tolist,flaglist = self._collect_lines(diffs)
  File C:\Python34\lib\difflib.py, line 1830, in _collect_lines
for fromdata,todata,flag in diffs:
  File C:\Python34\lib\difflib.py, line 1806, in _line_wrapper
self._split_line(fromlist,fromline,fromtext)
  File C:\Python34\lib\difflib.py, line 1791, in _split_line
self._split_line(data_list,'',line2)
  
  (repeated many times)

  File C:\Python34\lib\difflib.py, line 1791, in _split_line
self._split_line(data_list,'',line2)
  File C:\Python34\lib\difflib.py, line 1755, in _split_line
if (size = max) or ((size -(text.count('\0')*3)) = max):
RuntimeError: maximum recursion depth exceeded in comparison

--
nosy: +jftuga

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



[issue24294] DeprecationWarnings should be visible by default in the interactive REPL

2015-08-20 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

Astonishingly isatty appear to work on windows:

http://bugs.python.org/issue18553

Up to core python for istty().

--

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



[issue8987] Distutils doesn't quote Windows command lines properly

2015-08-20 Thread R. David Murray

R. David Murray added the comment:

Well, it sounds like there may be no way around the fact that people may 
already be doing the extra needed quoting escaping internal quotes) and 
therefore that this change would break those use cases.  (I note that any such 
code must be conditional on windows vs unix, since escaping the quotes will 
break the same command executed on unix).  

Unless...what if we conditionalize it on whether or not '\' and/or '\\' 
appears in the argument?

And yes, the fundamental problem is that Windows provides no way to call a 
program with a list of not-to-be-modified strings.  The problem with a .bat 
parsing its argument string differently from how everything else parses its 
argument string is not a new problem, and is faced by anyone using subprocess.  
distutils is trying to be (relatively) platform agnostic, to my understanding, 
so again we'd have to actually parse the input, this time looking for '.bat' 
and quoting accordingly.

If we solve the .bat problem (as opposed to ignoring it like we currently do in 
subprocess) we should fix it in subprocess too.

This is certainly getting non-trivial :(

--

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



[issue24294] DeprecationWarnings should be visible by default in the interactive REPL

2015-08-20 Thread Jim Jewett

Jim Jewett added the comment:

On windows, when python is started from the command line without a GUI, 
os.isatty(sys.stdin) raises an error, but os.isatty(sys.stdin.fileno()) returns 
true.  

Within IDLE, os.isatty(sys.stdin.fileno()) also raises an error, but 
os.isatty(0), os.isatty(1), and os.isatty(2) all return true.

I'm not sure exactly when you want which warning to show, let alone whether the 
above tests are relevant, but I'm happy to run some tests if you can tell me 
what you're looking for.

--

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



[issue24903] Do not verify destdir argument to compileall

2015-08-20 Thread R. David Murray

R. David Murray added the comment:

That line isn't checking the existence of destdir, but rather of the (single, 
because we have only one destdir to use) directory to compile.  

What bug are you actually seeing?

--
nosy: +r.david.murray

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



[issue24897] Add new attribute decorator (akin to property)?

2015-08-20 Thread Eric Snow

Eric Snow added the comment:

This sort of thread belongs on python-id...@python.org, not on the tracker.  
Please post there (feel free to reference this issue; also add a link to the 
thread here).  TBH, I think there's a larger discussion to be had regarding the 
topic of other useful descriptors that we should consider adding to Python.

In the meantime I'm closing this issue.  We can re-open it if the outcome of 
any python-ideas discussions warrants it.

--
nosy: +eric.snow, rhettinger
resolution:  - rejected
stage:  - resolved
status: open - closed
type:  - enhancement

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



[issue24897] Add new attribute decorator (akin to property)?

2015-08-20 Thread R. David Murray

R. David Murray added the comment:

So you are basically wanting to be able to create read only attributes that 
don't have a _ in front of them even internally.

I don't think that's something Python core should add.  Read only attributes 
should be an exceptional case in most python programs.  Fraction uses them 
because Fraction is an immutable type and those properties are involved in the 
hash calculation.

I've written an immutable class with a number of attributes (email.policy), and 
my solution involved a custom __setattr__, which really makes more sense for my 
use case.  So I think this should be left to the application/library to decide. 
That is, the solution isn't universal enough to go in the stdlib, IMO.

So, long story short, I'm -1 :)

--
nosy: +r.david.murray

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



[issue8987] Distutils doesn't quote Windows command lines properly

2015-08-20 Thread R. David Murray

R. David Murray added the comment:

*I'm* not suggesting using Popen.  That would be a more significant change to 
the code, and I don't see a motivation for it.  I'm just suggesting using 
list2cmdline for the quoting.  (If we were rewriting distutils it would be a 
different story, but we're not.)

And no, Popen with shell=True does *not* handle quoting.  If you use 
shell=True, *you* are responsible for doing correct quoting (and is what makes 
using shell=True so dangerous).  That applies to both unix and windows, and the 
confusion about that fact was what led to the need for the fix backout in 
issue 8972.

If a fix can't go in as a bug fix (whether or not it gets into 3.5.0), then we 
should perhaps instead consider the rewrite for 3.6: provide a *new* distutils 
function that does use Popen and does things right (based on everything we've 
learned since distutils was written), leaving the old function in place, 
deprecated, for backward compatibility.

That doesn't solve the problem for people running in to this bug trying to 
build extensions for 2.7, 3.4, and 3.5, though.

--

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



[issue24902] http.server: on startup, show host/port as URL

2015-08-20 Thread R. David Murray

R. David Murray added the comment:

This is a nice idea, but I think it would be better to add it to the message 
rather than change the message (and we'd still break some people's programs, 
I'm sure):

  Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000) ...

--
nosy: +r.david.murray

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



[issue24897] Add new attribute decorator (akin to property)?

2015-08-20 Thread Skip Montanaro

Skip Montanaro added the comment:

I'm missing the point too, I think. I don't see class attributes in your 
initial Foo class, then your second one as a __new__ method, but references 
self. I'm quite confused at this point.

--
nosy: +skip.montanaro

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



[issue24902] http.server: on startup, show host/port as URL

2015-08-20 Thread Felix Kaiser

New submission from Felix Kaiser:

http.server: on startup, show host/port as URL

Old:

% python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 ...

New:

% ./python -m http.server  
Serving http://0.0.0.0:8000/ ...

This is useful because (modern) terminals will auto-detect URLs and make them 
clickable, so printing an URL makes it easier to navigate the browser there.

--
components: Library (Lib)
files: http_server__on_startup_show_host_and_port_as_url.patch
keywords: patch
messages: 248882
nosy: fxkr
priority: normal
severity: normal
status: open
title: http.server: on startup, show host/port as URL
type: enhancement
Added file: 
http://bugs.python.org/file40214/http_server__on_startup_show_host_and_port_as_url.patch

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



[issue24903] Do not verify destdir argument to compileall

2015-08-20 Thread R. David Murray

R. David Murray added the comment:

So, given that that does something useful, it appears that the error message 
(which is what is in 2.7 as well) is wrong to refer to 'directory argument', 
and we should just eliminate the isdir check (and fix the error message).

The patch will need a test.

--
stage:  - needs patch
versions: +Python 3.5, Python 3.6

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



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2015-08-20 Thread Jan Hudec

Jan Hudec added the comment:

Oh, I see I misunderstood Gerhard's last commit.

So now the problem should be only if there is a DML statement followed by DDL 
statement and no commit afterwards. Well, that is indeed probably stupid.

--

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



[issue24898] Documentation for str.find() is confusing

2015-08-20 Thread Ted Lemon

Ted Lemon added the comment:

Hm, okay, that explains it.   I was previously mystified.  How about this as a 
refinement on your proposal, though:

Return the lowest index in the string where substring sub is found within the 
string.  Optional arguments start and end restrict the search to the slice of 
the string, s[start:end].  Returned index is relative to the beginning of the 
string, not the beginning of the slice. Return -1 if sub is not found.

--

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



[issue24902] http.server: on startup, show host/port as URL

2015-08-20 Thread Felix Kaiser

Felix Kaiser added the comment:

I'm not sure - that'd be redundant, and I find it harder to read. It also 
breaks for badly configured terminals where (/) are part of the 
select-by-word character set (but thats a very minor issue -- users with 
parentheses in the set will probably be used to broken links). Here's a new 
patch though. Your choice :-)

As for breaking programs: that message is clearly intended for human 
consumption. My opinion is that if someone parses that, they deserve the 
opportunity to fix their code. However, out of curiosity, I did search for code 
containing Serving HTTP on before opening the issue and couldn't find 
anything that's parsing that message.

--
Added file: 
http://bugs.python.org/file40215/http_server__on_startup_show_host_and_port_as_url.patch

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



[issue24902] http.server: on startup, show host/port as URL

2015-08-20 Thread R. David Murray

R. David Murray added the comment:

I do it in a number of test suites (you pass in localhost and port 0, then 
parse the output to find out what port got used).  I'm sure other people do it 
as well.  The parens could be dropped.  I don't think it is really redundant, 
as the two ways of presenting the info hit different parts of my brain: one is 
the part that looks at things from a networking perspective (ports and IPs) and 
the other that looks at it from a web perspective (urls).

--

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



[issue8987] Distutils doesn't quote Windows command lines properly

2015-08-20 Thread Steve Dower

Steve Dower added the comment:

Maybe a better starting point is to monkey-patch via setuptools? I know it's 
nasty, but it'll give us a chance to actually iterate on this before committing 
to a distutils change. (IMO the biggest problem with distutils is that it gets 
basically no testing before a final release, other than people who have already 
worked around its issues.) CCompiler.spawn is fairly easy to patch too.

Adding Jason in case he's still so upset from last time I did this (finding VC 
compiler for 2.7) he wants to shut the suggestion down immediately :)

As an aside, escaping quotes by doubling them (as in the OP) works fine for 
MSVC, but is not necessarily standard across all applications. Escaping with a 
backslash is probably more common, but (e.g.) batch files don't need them 
escaped if they aren't followed by a space and can't escape them at all if they 
are followed by a space (then again, we all agree that cmd.exe is fundamentally 
broken here, so using 
https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391.aspx 
(CommandLineToArgvW API) as the benchmark is reasonable).

--
nosy: +jason.coombs

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



[issue24893] Tk occasionally mispositions Text() insert cursor on mouse click.

2015-08-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

[Ned]
 the out-of-date Apple-supplied Tk *might* be in use.

It also happens to me and my students periodically.  Our Tk is up-to-date.

--

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



[issue24847] Can't import tkinter in Python 3.5.0rc1

2015-08-20 Thread Steve Dower

Steve Dower added the comment:

FYI - the Tcl and Tk changes have been committed upstream: 
http://core.tcl.tk/tcl/tktview/00189c4afcb9e2586301d711f71383e48817a72d

--

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



[issue24897] Add new attribute decorator (akin to property)?

2015-08-20 Thread Eric Snow

Eric Snow added the comment:

No worries, Emanuel.  Thanks for bringing it up.  I'd still be interested to 
see what sort discussion ensued if you took this to python-ideas.  Starting a 
thread on the topic has been on my todo list for a while but other matters 
always end up taking precedence. :)

--

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



[issue24903] Do not verify destdir argument to compileall

2015-08-20 Thread Jake Garver

Jake Garver added the comment:

Thanks for the response and sorry for the mis-read.

In 2.7, I did something like:
python -m compileall -d /runtime/path foo.py

But in 3.4, I get:
-d destdir requires exactly one directory argument

I'm doing this during a build. Then we package the pyc file into a runtime 
image.

Let me know if I can further help (or confuse).

--

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



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2015-08-20 Thread Jan Hudec

Jan Hudec added the comment:

While I agree that the current behaviour is a bug (this bug), and one that 
renders the package unusable for me (I used apsw or different language 
instead), I unfortunately have to disagree with Gerhard that the change is not 
a problem. It can be.

The implicit commit before DDL statements that is gone is not a problem, but 
the implicit commit *after* them that is *also* gone is. Because if somebody 
only does DDL statements, and upgrade script might do just that, they will now 
need a commit.

Scripts that use dbapi2 in a portable way will have the commit, because other 
databases that support DDL in transactions require it already. But scripts that 
are only used with current sqlite and possibly mysql (behaviour of which the 
current version mimics) may not and will break.

--

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



[issue24903] Do not verify destdir argument to compileall

2015-08-20 Thread R. David Murray

R. David Murray added the comment:

Actually, it looks like it is a bit more potentially complex than that.  The 
original code would issue the error only if there were more than one argument 
and the first one was not a directory.  So it would in fact compile more than 
one argument as long as the first one was a dir.

It's not clear what purpose that check was supposed to serve.

--

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



[issue24305] The new import system makes it impossible to correctly issue a deprecation warning for a module

2015-08-20 Thread Brett Cannon

Brett Cannon added the comment:

Could someone do a quick code review of my latest patch? If the design looks 
sane I might be able to steal some time tomorrow to start on the C 
implementation.

--

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



[issue24904] Patch: add timeout to difflib SequenceMatcher ratio() and quick_ratio()

2015-08-20 Thread John Taylor

New submission from John Taylor:

SequenceMatcher in the difflib module contain ratio() and quick_ratio() methods 
which can take a long time to run with certain input.  One example is two 
slightly different versions of jquery.min.js.

I have written a patch against python-350b4 that adds a timeout to these 
methods.  The new functionality also has the capability to fall through to 
the next quickest comparison method should a timeout occur. If a timeout does 
occur and using a fall through method is not desired, then -1 is returned for 
the ratio.

I'd like this to be incorporated into Python 3.5.0 if it is not too late.

--
components: Library (Lib)
files: difflib-diff.patch
keywords: patch
messages: 248919
nosy: jftuga
priority: normal
severity: normal
status: open
title: Patch: add timeout to difflib SequenceMatcher ratio() and quick_ratio()
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file40217/difflib-diff.patch

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



[issue8987] Distutils doesn't quote Windows command lines properly

2015-08-20 Thread Chris Hogan

Chris Hogan added the comment:

 Since issue 8972 has been resolved by fixing the broken behavior, I think we 
 should just use list2cmdline.  
 We could leave _nt_quote_args alone and replace the call to it in _spawn_nt 
 with:

  cmd = [list2cmdline([arg]) for arg in cmd]

I verified that this passes the high-level test I wrote.

--

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



[issue8987] Distutils doesn't quote Windows command lines properly

2015-08-20 Thread Steve Dower

Steve Dower added the comment:

The problem is I can easily find plenty of cases where it won't work.

My biggest concern is that list2cmdline will require already-quoted arguments, 
which is going to break anyone who's already worked around distutils failing to 
do so (which makes it really difficult to justify fixing 2.7 and 3.4, and soon 
3.5 unless we get it into 3.5.0). The escaping it applies for '\' also does 
not take into account someone who has correctly escaped their own argument.

Particularly for distutils, we look up tools by simple name and use PATHEXT, so 
we may find someone's link.bat, which then needs very different quoting from 
the actual link.exe (this one is probably unsolvable, unfortunately).

The solution isn't as simple as calling an existing function. It's probably 
actually as complicated as requiring callers to specify whether strings are 
quoted or not, and then switching between quoting modes based on what type of 
program (ie. EXE vs BAT) is being launched. list2cmdline is false hope here, 
IMO, as it just makes it harder for people to work around.

--

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



[issue8987] Distutils doesn't quote Windows command lines properly

2015-08-20 Thread Steve Dower

Steve Dower added the comment:

FWIW, the problem in the original post is that '-DMODULE_VERSION=1.0.5' is 
not quoted by distutils and the quotes are eaten.

This can be fixed by specifying '-DMODULE_VERSION=\1.0.5\'. There are no 
spaces in the argument, so the problem is that cl.exe eats unescaped quotes, 
not that we aren't automatically changing users arguments.

--

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



[issue24294] DeprecationWarnings should be visible by default in the interactive REPL

2015-08-20 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

Hum, working on the automated test. It is slightly annoying as with subprocess 
python is not in a tty, so there will be no change in behavior. I'm not sure 
how to proceed. 

 At a minimum, an interactive test should be written and added to the 
 documentation

Where would that be ? In the warnings docs, or is there a specific place for 
Manual tests ?

--

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



[issue24893] Tk occasionally mispositions Text() insert cursor on mouse click.

2015-08-20 Thread Guido van Rossum

Guido van Rossum added the comment:

I don't have that laptop any more. It's likely that the screen resolution 
change caused Tcl/Tk to be confused. That's probably a Tcl/Tk bug.

--

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



[issue24294] DeprecationWarnings should be visible by default in the interactive REPL

2015-08-20 Thread Jim Jewett

Jim Jewett added the comment:

Instead of using python directly in a subprocess, try calling a shell command 
that in turns calls python.  (Admittedly, this may look like the pipe 
scenario...)

In theory, you could even drive another python interactively, using a GUI 
runner, but I'm not sure how much new infrastructure that would add to the test 
suite, so it might not be worth it.

I'm not aware of a list of manual tests (though perhaps there *should* be 
one...); I would put it under the DeprecationWarning docs, sort of like an 
example.  Others may have better ideas.

--

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



[issue24893] Tk occasionally mispositions Text() insert cursor on mouse click.

2015-08-20 Thread Guido van Rossum

Changes by Guido van Rossum gu...@python.org:


--
nosy:  -gvanrossum

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



[issue24904] Patch: add timeout to difflib SequenceMatcher ratio() and quick_ratio()

2015-08-20 Thread STINNER Victor

STINNER Victor added the comment:

I'm not sure that it's a good idea to add a timeout to such algorithm. It can 
be very surprising to have a difference result depending on the system load 
(CPU usage of _other_ applications) and on the CPU performances.

If you really want this result, I would prefer to design the feature outside 
the Python stdlib. You might modify the stdlib to allow incremental computation.

About the patch itself, which kind of timer should be used? Monotonic clock? 
System clock? Process time (CPU time)?

Maybe we can optimize the code?

--
nosy: +haypo

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