[issue32848] Valgrind error with python

2018-02-14 Thread Arun Solomon

New submission from Arun Solomon :

Hi... 

I am facing the problem python along with valgrind. I was getting default 
valgrind warnings messages. I have created the sample.py. sample.py file does 
not have any code. I created empty py file to confirm that my code does not 
have any memory leaks. 

Following is the valgrind command that I am using in command line:
valgrind --leak-check=full --show-reachable=yes --error-limit=no 
--gen-suppressions=all --log-file=msm_suppress.log -v 
/home/arunspra/py_src/Python-2.7.5/python sample.py

I was getting plenty of valgrind warnings.

I surfed in the google and I got to know that i need to configure python by 
disabling pymalloc. As said by technical peoples, If pymalloc was disabled, we 
would not got any memory related errors. But i was getting the memory related 
error. Following is my command that i used to disable pymalloc:

./configure --without-pymalloc --with-pydebug
make

Then I ran above said valgrind command. I was getting 1299 valgrind warnings. 
If i enable pymalloc, I was getting only 108 valgrind warnings.

Following is my software versions:
Cent os: 7.3
Python: 2.7.5
Valgrind: 3.12.0


PS: If i configure and build python, i was getting an Import Error: No module 
named netifaces. I am using netifaces in my project. If i use system inbuilt 
python, i am not getting netifaces import error.

Can anyone please advice me to resolve this issue.

--
components: Build
files: suppress.zip
messages: 312193
nosy: Arun Solomon, vstinner
priority: normal
severity: normal
status: open
title: Valgrind error with python
type: compile error
versions: Python 2.7
Added file: https://bugs.python.org/file47443/suppress.zip

___
Python tracker 

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



Re: Why there is no "setdefaultencoding" in sys module?

2018-02-14 Thread rajindermohan001
On Friday, July 9, 2010 at 9:28:35 PM UTC+5:30, crow wrote:
> Hi, everyone
> 
> I'm a new hand at python.
> 
> I tried to set system default encoding by using
> 
> "import sys; sys.setdefaultencoding('utf-f')",
> 
> but I got error message:
> 
> >>> sys.setdefaultencoding('utf-8')
> Traceback (most recent call last):
>   File "", line 1, in 
> AttributeError: 'module' object has no attribute 'setdefaultencoding'
> 
> Then I checked dir(sys), seems there was no function named
> "setdefaultencoding" in "sys" module. But in python's document, it
> said I should use sys.setdefaultencoding.
> 
> So, my questions: why there is no setdefaultencoding in sys module? if
> I want to change system's default encoding, what should I do?
> 
> Thanks in advance

Becuase you are using python 3.setdefaultencoding is no longer supportedin 
python 3. python3automatically have utf-8 in its configuration by default. so 
you don't have to use it. just remove the line.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32642] add support for path-like objects in sys.path

2018-02-14 Thread Jay Yin

Change by Jay Yin :


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

___
Python tracker 

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



[issue32773] distutils should NOT preserve timestamps

2018-02-14 Thread Jay Yin

Change by Jay Yin :


--
pull_requests: +5483

___
Python tracker 

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



[issue32847] Add DirectoryNotEmptyError subclass of OSError

2018-02-14 Thread Barry A. Warsaw

New submission from Barry A. Warsaw :

I just ran across errno 39 (Directory not empty) when using Path.rename(newdir) 
when newdir already existed and was not empty.  I realized that OSError 
exceptions don't have a DirectoryNotEmptyError subclass.  Maybe we should add 
one?

Probably not important or common enough to add for 3.7 given we're in beta now.

--
messages: 312192
nosy: barry
priority: normal
severity: normal
status: open
title: Add DirectoryNotEmptyError subclass of OSError
versions: Python 3.8

___
Python tracker 

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



[issue32839] Add after_info as a function to tkinter

2018-02-14 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

A person who can create a tcl callback with tk.call can inquire with 
tk.call('after', 'info', id).  That does not cover callbacks created by tcl or 
extensions thereof, but references to such callbacks are unlikely to be useful 
to anyone who does not know any tcl.

I see these choices for after_info(id):

A. Return the tcl script reference even when it wraps a python function.  I 
don't like this, as the tcl reference is useless to most people.

B. Convert the reference to a Python function if possible but return it if not. 
 This is a bit awkward to document and any use requires a type check.  Having a 
function return such different types, depending on the input, is frowned upon.

C. Convert the reference to a function if possibe and raise TypeError or 
ValueError is not.  This is incomplete but easier for a pure Python programmer 
to deal with.  The documentation could specify how those who want a tcl 
reference can get it.

D. Don't implement after_info(id), at least not now, and just after_info().  
Information about the current existence of a callback is contained in the list 
returned by after_info().  Each of the following pairs should be equivalent:

  assertIn(id, after_info())
  assertEqual(len(after_info(id)), 2)

  assertNotIn(id, after_info())
  assertRaises(TclError, after_info, id)

(For testing after_info(), assertIn and assertNotIn avoid assuming that tcl 
does not add any internal callbacks.)

--

___
Python tracker 

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



[issue32845] Mac: Local modules can shadow builtins (e.g. a local `math.py` can shadow `math`)

2018-02-14 Thread Ned Deily

Ned Deily  added the comment:

This had me confused for a while.  But eric.smith's comment is the clue to 
what's going on here:

> This is the expected behavior, fortunately or not. "math" is not builtin in 
> the sense that is used in that paragraph.

The difference in behavior that you are seeing seems to be due to the fact that 
the Debian/Ubuntu uses a non-standard build to build-in the standard lib "math" 
module, whereas the Mac version you are using undoubtedly does not.  You can 
see this behavior yourself if you build your own version of python (either 2.7 
or 3.x) on your Ubuntu system.  You should now see the same behavior you see on 
the Mac.  For example:

# on a current Debian system
$ /usr/bin/python2.7 -c 'import sys,math;print(sys.modules["math"])'


# on a current Mac system using the python.org 2.7.14
$ /usr/local/bin/python2.7 -c 'import sys,math;print(sys.modules["math"])'


So, I don't think this is an issue at all.  Please reopen if you think there is 
actually a problem here.

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

___
Python tracker 

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



[issue32845] Mac: Local modules can shadow builtins (e.g. a local `math.py` can shadow `math`)

2018-02-14 Thread Eric V. Smith

Eric V. Smith  added the comment:

Removing macOS since this isn't Mac specific.

--
components: +Interpreter Core -macOS

___
Python tracker 

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



[issue32846] Deletion of large sets of strings is extra slow

2018-02-14 Thread Terry J. Reedy

New submission from Terry J. Reedy :

https://metarabbit.wordpress.com/2018/02/05/pythons-weak-performance-matters/, 
a blog post on cpython speed, clains "deleting a set of 1 billion strings takes 
>12 hours".  (No other details provided.)

I don't have the 100+ gigabytes of ram needed to confirm this, but with 
installed 64 bit 3.7.0b1 with Win10 and 12 gigabyes, I confirmed that there is 
a pronounced super-linear growth in string set deletion (unlike with an integer 
set).  At least half of ram was available.

  Seconds to create and delete sets
millionsintegersstrings
of items  create delete  create delete
   1 .08.02 .36.08
   2 .15.03 .75.17
   4 .30.061.55.36
   8 .61.123.18.76
  161.22.246.48   1.80  < slightly more than double
  322.4 .50   13.65.56  < more than triple
  644.91.04   28 19 < nearly quadruple
 128   10.92.25
 100  56 80 < quadruple with 1.5 x size

For 100 million strings, I got about the same 56 and 80 seconds when timing 
with a clock, without the timeit gc suppression.  I interrupted the 128M string 
run after several minutes.  Even if there is swapping to disk during creation, 
I would not expect it during deletion.

The timeit code:

import timeit

for i in (1,2,4,8,16,32,64,128):
print(i, 'int')
print(timeit.Timer(f's = {{n for n in range({i}*100)}}')
  .timeit(number=1))
print(timeit.Timer('del s', f's = {{n for n in range({i}*100)}}')
  .timeit(number=1))

for i in (1,2,4,8,16,32,64,100):
print(i, 'str')
print(timeit.Timer(f's = {{str(n) for n in range({i}*100)}}')
  .timeit(number=1))
print(timeit.Timer('del s', f's = {{str(n) for n in range({i}*100)}}')
  .timeit(number=1))

Raymond, I believe you monitor the set implementation, and I know Victor is 
interested in timing and performance.

--
messages: 312188
nosy: rhettinger, terry.reedy, vstinner
priority: normal
severity: normal
stage: needs patch
status: open
title: Deletion of large sets of strings is extra slow
type: performance
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



[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer

Change by Devin Bayer :


--
nosy:  -akvadrako

___
Python tracker 

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



[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer

Devin Bayer  added the comment:

This bug is 5 years old and you are arguing what? That it doesn't matter 
because it's rarely used compared to some undocumented useless alternative?

It's mildly interesting to hear about some implementation detail but I really 
don't care. I think you're just wasting your time. I want the docs to match the 
implementation.

But it doesn't matter - argparse is shit anyway - I'll just write my own parser.

--

___
Python tracker 

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



[issue32845] Mac: Local modules can shadow builtins (e.g. a local `math.py` can shadow `math`)

2018-02-14 Thread Eric V. Smith

Eric V. Smith  added the comment:

This is the expected behavior, fortunately or not. "math" is not builtin in the 
sense that is used in that paragraph.

--
nosy: +eric.smith

___
Python tracker 

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



[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread paul j3

paul j3  added the comment:

REMAINDER is not widely used, and probably was not tested thoroughly during 
development. It works for the example given in the docs.  

A variant, argparse.PARSER ('A...') is widely used.  This is, effectively, 
REMAINDER ('...') that requires an initial non-optional string.  Sort of what 
'+' is to '*'.

I suspect REMAINDER is most reliable when used as nargs for an optional, e.g.

add_argument('--rest', nargs=argparse.REMAINDER)

That way it's clear to everyone, developer, user, and the parser that the 
following strings are to be taken is.  

When parsing the command line, clarity should have priority over convenience.

--

___
Python tracker 

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



[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread paul j3

paul j3  added the comment:

Oops, I see I already mentioned 9334.  Here the parsing sequence is a bit 
different, and the fix I suggest there would not apply here.  But the 
underlying issue is still there - the parser has, in its first iteration, 
determined that the '--def' looks like an optional.  This first scan focuses on 
the form, not on possible 'nargs' sequences.

In _parse_known_args() it alternates between 'consume_positionals' and 
'consume_optional'

In the docs example:

'--foo B cmd --arg1 XX ZZ'

It finds the '--foo' and parses that as optional, consuming the 'B'

Next it finds 'cmd', and so starts to parse positionals.  Here is pays 
attention to the REMAINDER, and thus consumes 'cmd' and the following strings.  
In other words, once it starts to parse positionals, it can parse as many as 
match their nargs.

The same applies to the 'abc --def' example given at the start of this question.

But in the 2nd example, with just the REMAINDER and a ['--def'], it doesn't 
parse any positionals.  The code has this comment:

   # consume any Positionals preceding the next option

There aren't any strings preceding the '--def', so it moves on to parsing this 
'optional'.  Yes, I know you think it really is a positional, because you know 
about the REMAINDER nargs, but the code doesn't know this (or at least doesn't 
check for that possibility.

As stressed in 9334, when a dashed string is used in a argument like slot, 
there's an inherent ambiguity.  Should it treat as a (potential) error, or 
accept the programmer and/or user is going against convention?

https://bugs.python.org/issue9334#msg111691

--

___
Python tracker 

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



[issue32845] Mac: Local modules can shadow builtins (e.g. a local `math.py` can shadow `math`)

2018-02-14 Thread Eric Cousineau

New submission from Eric Cousineau :

We ran into an issue with our library; we build a submodule named `math.so`, 
and have a test `math_test` which is ran in the same directory as this module 
(since this is how we've written it with Bazel's generated Python binaries):
https://github.com/RobotLocomotion/drake/issues/8041

This happens for us on HighSierra / Sierra MacOS (for *.py and *.so modules); 
Ubuntu Linux seems fine.

I have a reproduction script just for *.py files here:
https://github.com/EricCousineau-TRI/repro/blob/b08bc47/bug/mac_builtin_shadow/test.sh#L38
(attached this as `test.sh`)

The module is exposed on the path given that it neighbors the first execution 
of the `import_test.py` script. The second execution (where the 
`import_test.py` script is moved up one level) succeeds on Mac (s.t. the 
`math.py` is not in `sys.path`).

This behavior seems to violate the documentation:
https://docs.python.org/2/tutorial/modules.html#the-module-search-path

--
components: macOS
files: test.sh
messages: 312183
nosy: Eric Cousineau, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Mac: Local modules can shadow builtins (e.g. a local `math.py` can 
shadow `math`)
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file47442/test.sh

___
Python tracker 

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



What F strings should have been

2018-02-14 Thread D'Arcy Cain
A recent post by Terry Jan Reedy got me thinking about formatting.  I
like the new(ish) format method for strings and I see some value in F
strings but it only works well with locals.  Anything more starts
getting messier than format() and it is supposed to be cleaner.  Also, I
find that I tend to re-use format strings and wish there was a
formatting string option.  Here is what I came up with.

class FSTR(str):
  def __call__(self, *args):
return self.format(*args)

And here is how it could be used.

s = FSTR("ABC {1} {0} {2[x]}")
...
print(s(1, 2, dict(x=3)))

Too bad that it is too late to assign f'' to that function.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32844] subprocess may incorrectly redirect a low fd to stderr if another low fd is closed

2018-02-14 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

Note that the PR doesn't attempt to fix leaking of low dup'ed fds to the child. 
I'll file a separate report for that in a while.

--

___
Python tracker 

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



[issue32844] subprocess may incorrectly redirect a low fd to stderr if another low fd is closed

2018-02-14 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue32844] subprocess may incorrectly redirect a low fd to stderr if another low fd is closed

2018-02-14 Thread Alexey Izbyshev

New submission from Alexey Izbyshev :

When redirecting, subprocess attempts to achieve the following state: each fd 
to be redirected to is less than or equal to the fd it is redirected from, 
which is necessary because redirection occurs in the ascending order of 
destination descriptors. It fails to do so if a low fd (< 2) is redirected to 
stderr and another low fd is closed, which may lead to an incorrect 
redirection, for example:

$ cat test.py
import os
import subprocess
import sys

os.close(0)

subprocess.call([sys.executable, '-c',
 'import sys; print("Hello", file=sys.stderr)'],
stdin=2,
stderr=1)

$ python3 test.py 2>/dev/null
$ python3 test.py >/dev/null
Hello

Expected behavior:
$ python3 test.py >/dev/null
$ python3 test.py 2>/dev/null
Hello

--
components: Extension Modules, Library (Lib)
messages: 312181
nosy: gregory.p.smith, izbyshev
priority: normal
severity: normal
status: open
title: subprocess may incorrectly redirect a low fd to stderr if another low fd 
is closed
type: behavior
versions: 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



[issue32840] Must install python 3.6.3 when 3.6.4 already installed

2018-02-14 Thread Ned Deily

Change by Ned Deily :


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

___
Python tracker 

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



Re: Old format with %

2018-02-14 Thread Terry Reedy

On 2/14/2018 7:54 AM, ast wrote:

Le 14/02/2018 à 13:46, ast a écrit :

Hello

It seems that caracter % can't be escaped

 >>>"test %d %" % 7
ValueError: incomplete format

 >>>"test %d \%" % 7
ValueError: incomplete format

 >>>"test %d" % 7 + "%"
'test 7%'  # OK

But is there a way to escape a % ?

thx


Found, double % to escape it

 >>>"test %d%%" % 7
'test 7%'


Same with { and } in new format and f strings.
>>> a = 3
>>> f'{{x:{a}}}'
'{x:3}'

--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer

Devin Bayer  added the comment:

I still don't understand how that corresponds to the described behavior of 
REMAINDER and what it has to do with this bug.

How can REMAINDER possibly ever work if optionals take priority? However it 
does when it's not the first argument.

--

___
Python tracker 

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



[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread paul j3

paul j3  added the comment:

This is another expression of the bigger problem of handling arguments that 
look like flags.  In optparse the 'nargs' (or equivalent, it doesn't handle 
positionals), control how many arguments an Option takes, regardless of their 
form.  In argparse, the distinction between a option (flag) and argument has 
priority.  So it is difficult to treat strings like '--def' as a plain 
argument.  The default behavior is to treat it as an optional flag.

https://bugs.python.org/issue9334

--

___
Python tracker 

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



[issue20632] Define a new __key__ protocol

2018-02-14 Thread Nick Coghlan

Nick Coghlan  added the comment:

Allowing for None-first and None-last ordering is a fair use case, but I'm not 
sure a __key__ protocol is the right answer to that - as your own example 
shows, it gets tricky when dealing with nested containers.

It may make sense to raise the question on python-ideas for Python 3.8+, 
though, with Python-side ordering of database records as the main motivating 
use case.

--

___
Python tracker 

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



[issue32839] Add after_info as a function to tkinter

2018-02-14 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

>>> It is internal, it was not exposed to Tkinter users before, and the API for 
>>> restoring the original Python callable is private.

I thought `bind(sequence)` also returned these internal Tcl function names?  
For example, if I do a print on the set_breakpoint_here text widget in IDLE, it 
prints :
if {"[140358823678376set_breakpoint_here %# %b %f %h %k %s %t %w %x %y %A %E %K 
%N %W %T %X %Y %D]" == "break"} break


In order for it to return the python function name, I think the `after` 
function would need to write to a dictionary of `name: func` where name is 
currently used as the Tcl function name that is registered?  Is there something 
in tkinter that does this now that it could be modeled from?  Since events are 
removed from Tcl once that are invoked, how would the dictionary be cleaned up? 
 Would after_info need to be polled every once in a while to clean up the 
dictionary or would it just exist until the object is destroyed?

--

___
Python tracker 

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



[issue32436] Implement PEP 567

2018-02-14 Thread Yury Selivanov

Change by Yury Selivanov :


--
pull_requests: +5481

___
Python tracker 

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



[issue32820] Add bits method to ipaddress

2018-02-14 Thread Eric Osborne

Eric Osborne  added the comment:

Cool, I will kick it over to python-ideas.  I checked in some code to
handle the format string and it's a lot like what you're suggesting, so
I'll leave that in there and see what happens.
Thanks!

eric

On Tue, Feb 13, 2018 at 11:56 PM Nick Coghlan 
wrote:

>
> Nick Coghlan  added the comment:
>
> Aye, definitely worth a thread on python-ideas. My rationale for
> suggesting something based on the built-in numeric codes is that it makes
> it straightforward for *users* to transfer knowledge from that
> mini-language.
>
> As far as parsing goes, I was thinking of something along the lines of the
> following naive approach:
>
> typechar = fmt[-1:]
> if not typechar or typechar not in ("b", "n", "x"):
> return super().__format__(fmt)
> prefix, group_sep, suffix = fmt[:-1].rpartition("_")
> if prefix and prefix != "#" or suffix:
> return super().__format__(fmt)
> field_width = self._calculate_field_width(typechar)
> return format(int(self),
> f"{prefix}0{field_width}{group_sep}{type_char}")
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue32795] subprocess.check_output() with timeout does not exit if child process does not generate output after timeout

2018-02-14 Thread Eryk Sun

Eryk Sun  added the comment:

Work on related issues extends back 9 years to issue 5115. Also see issue 26534.

--
nosy: +eryksun

___
Python tracker 

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



[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer

Devin Bayer  added the comment:

I don't understand how this is about positionals vs optionals. REMAINDER is 
supposed to capture everything from that point forward, not just positionals.

--

___
Python tracker 

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



[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer

Devin Bayer  added the comment:

Can we at least document that argparse.REMAINDER cannot be used as the first 
argument?

--

___
Python tracker 

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



[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer

Change by Devin Bayer :


--
nosy: +akvadrako

___
Python tracker 

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



Re: Old format with %

2018-02-14 Thread ast

Le 14/02/2018 à 13:46, ast a écrit :

Hello

It seems that caracter % can't be escaped

 >>>"test %d %" % 7
ValueError: incomplete format

 >>>"test %d \%" % 7
ValueError: incomplete format

 >>>"test %d" % 7 + "%"
'test 7%'  # OK

But is there a way to escape a % ?

thx


Found, double % to escape it

>>>"test %d%%" % 7
'test 7%'
--
https://mail.python.org/mailman/listinfo/python-list


Old format with %

2018-02-14 Thread ast

Hello

It seems that caracter % can't be escaped

>>>"test %d %" % 7
ValueError: incomplete format

>>>"test %d \%" % 7
ValueError: incomplete format

>>>"test %d" % 7 + "%"
'test 7%'  # OK

But is there a way to escape a % ?

thx
--
https://mail.python.org/mailman/listinfo/python-list


[issue32795] subprocess.check_output() with timeout does not exit if child process does not generate output after timeout

2018-02-14 Thread Fangyi Zhou

Fangyi Zhou  added the comment:

I choose to implement the first way. I believe this is in favour in prevention 
of resource leaks and zombie processes.

https://github.com/python/cpython/pull/5684

--

___
Python tracker 

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



[issue32795] subprocess.check_output() with timeout does not exit if child process does not generate output after timeout

2018-02-14 Thread Fangyi Zhou

Change by Fangyi Zhou :


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

___
Python tracker 

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



[issue32756] argparse: parse_known_args: raising exception on unknown arg following known one

2018-02-14 Thread Yauhen

Yauhen  added the comment:

I am adding one more testcase in order to clarify more the problem:



import argparse
import sys

parser = argparse.ArgumentParser(prog=sys.argv[0], add_help=False)
parser.add_argument('-a', action='store_true')
parser.add_argument('-b', action='store_true')
parser.add_argument('-c', action='store_true')
parsed_args, unknown_args = parser.parse_known_args(sys.argv[1:])
print(parsed_args)
print(unknown_args)



$ python argparse_test.py -ab
Namespace(a=True, b=True, c=False)
[]


Expected result:
$ python argparse_test.py -ab -cd
Namespace(a=True, b=True, c=True)
['-d']

Actual result:
$ python argparse_test.py -ab -cd
usage: argparse_test.py [-a] [-b] [-c]
argparse_test.py: error: argument -c: ignored explicit argument 'd'

--

___
Python tracker 

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



[issue32843] More revisions to test.support docs

2018-02-14 Thread Cheryl Sabella

New submission from Cheryl Sabella :

Serhiy had made the following comments on the pull request for issue11015, but 
that PR was merged before applying his requested changes.  This issue is to 
address his concerns.


TESTFN_NONASCII - How different from TESTFN_UNICODE?
PGO -  value? True/False?
TEST_SUPPORT_DIR - Not used.
max_memuse - Not used.
MISSING_C_DOCSTRINGS - Remove `Return` since it's a constant.
HAVE_DOCSTRINGS - Remove `Check` since it's a constant.

Possibly group the next 3 to avoid repetition:
unlink(filename) - Add an explanation why this is needed (due to antiviruses 
that can hold files open and prevent thy deletion).
rmdir(filename) - Add an explanation why this is needed (due to antiviruses 
that can hold files open and prevent thy deletion).
rmtree(path) - Add an explanation why this is needed (due to antiviruses that 
can hold files open and prevent thy deletion).

make_legacy_pyc(source) - Add markup references to PEPs.
system_must_validate_cert(f) - This is a decorator and change text to "Skip the 
test on TLS certificate validation failures.".

match_test(test) and set_match_tests(patterns) - Used internally to regrtest.  
Remove or ask Victor to document as the current documentation is useless.

check_impl_detail(**guards) - Document that a boolean is returned and check the 
docstring to include more information.

get_original_stdout - Add ().

strip_python_strerr(stderr) - Typo `strip_python_stderr` and make it clear that 
*stderr* is a byte string.

disable_faulthandler() - Wrong description.

disable_gc() - Add that it works only if it was enabled.

start_threads(threads, unlock=None) - Document that *threads* is a sequence of 
threads and document what unlock is.

calcobjsize(fmt) - Add the purpose of this - calcobjsize() returns the size of 
Python object (PyObject) whose structure is defined by fmt with account of 
Python object header.
calcvobjsize(fmt) - Same as above for PyVarObject.

requires_freebsd_version(*min_version) - Change to skip the test instead of 
Raise.

cpython_only(test) - Remove argument.
no_tracing(func) - Remove argument.
refcount_test(test) - Remove argument.
reap_threads(func) - Remove argument.
bigaddrspacetest(f) - Remove argument.

import_module(name, deprecated=False, *, required_on()) - Missed =

check_free_after_iterating(test, iter, cls, args=()) - This description is 
misleading. This function doesn't test iter. iter is either iter or reversed, 
cls is a base iterable class, args are arguments for its constructor. The true 
description is too complex, I suggest to remove this function from the 
documentation.

missing_compiler_executable(cmd_names=[]) - It is used only in distutils tests 
and should be in distutils.tests.support.

CleanImport(*module_names) - Format DeprecationWarning as a link.

DirsOnSysPath(*paths) - Format first sys.path as a link, Keeps the first one 
(in the above sentence) and format other mentions as ``sys.path`` or 
:data:`!sys.path`.

SaveSignals() - How to use it?

Matcher() - This class is used only in test_logging, and only with TestHandler. 
These classes should be documented together and with references to logging. I'm 
not sure they should be in test.support.

BasicTestRunner() - This is an internal class used for implementing 
run_unittest(). No need to expose it.

TestHandler(logging.handlers.BufferingHandler) - I'm not sure it should be in 
test.support rather of test_logging.

assert_python_ok(*args, **env_vars) - Since this is a keyword argument name, it 
should be formatter as *__cleanenv*.

--
assignee: docs@python
components: Documentation
messages: 312170
nosy: csabella, docs@python, ncoghlan, serhiy.storchaka, terry.reedy
priority: normal
severity: normal
status: open
title: More revisions to test.support docs
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue30455] Generate C code from token.py and not vice versa

2018-02-14 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -5479

___
Python tracker 

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



[issue30455] Generate C code from token.py and not vice versa

2018-02-14 Thread Zachary Ware

Change by Zachary Ware :


--
keywords: +patch
pull_requests: +5479

___
Python tracker 

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



[issue32841] Asyncio.Condition prevents cancellation

2018-02-14 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Well, makes sense

--

___
Python tracker 

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



[issue32841] Asyncio.Condition prevents cancellation

2018-02-14 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

> Having shield not cancel immediately but rather wait and cancel will cause 
> long timed shielded operations to stall the task cancellation, usually for no 
> good. This isn't the general case.

What I'm suggesting is that maybe it actually is good in the general case :-). 
If an operation can't be cancelled, that's too bad, but it's generally still 
better to wait then to silently leak it into the background.

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

___
Python tracker 

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



[issue32841] Asyncio.Condition prevents cancellation

2018-02-14 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Thanks Bar Harel

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



[issue32841] Asyncio.Condition prevents cancellation

2018-02-14 Thread Andrew Svetlov

Andrew Svetlov  added the comment:


New changeset a23eecab9a0b724bdfde83d159ac2415927f042a by Andrew Svetlov (Miss 
Islington (bot)) in branch '3.6':
bpo-32841: Fix cancellation in awaiting asyncio.Condition (GH-5665) (GH-5683)
https://github.com/python/cpython/commit/a23eecab9a0b724bdfde83d159ac2415927f042a


--

___
Python tracker 

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



Re: Respam levels.

2018-02-14 Thread Anssi Saari
Mark Lawrence  writes:

>> This may be the result of a misconfigured spam filter, or an actual spam
>> attack; anyway, I've now filtered news.bbs.geek.nz from my feed.
>>
> IIRC the same source for the "nospam" stuff of some months ago which I
> believe was purely accidental.

It's kinda funny, back in the 90s Usenet was spammed every now and again
by various misconfigured BBS's running a Usenet gateway. Usually sending
all messages back from every group to every group. I thought BBS's are
fairly dead and Usenet is mostly gone too but apparently this downside
has made a comeback.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32841] Asyncio.Condition prevents cancellation

2018-02-14 Thread miss-islington

miss-islington  added the comment:


New changeset 8caee0fa572e8ced00df553a7bdca49ddaf729e8 by Miss Islington (bot) 
in branch '3.7':
bpo-32841: Fix cancellation in awaiting asyncio.Condition (GH-5665)
https://github.com/python/cpython/commit/8caee0fa572e8ced00df553a7bdca49ddaf729e8


--
nosy: +miss-islington

___
Python tracker 

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



[issue32841] Asyncio.Condition prevents cancellation

2018-02-14 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5478

___
Python tracker 

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



[issue32841] Asyncio.Condition prevents cancellation

2018-02-14 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5477

___
Python tracker 

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



[issue32841] Asyncio.Condition prevents cancellation

2018-02-14 Thread Andrew Svetlov

Andrew Svetlov  added the comment:


New changeset 5746510b7aef423fa4afc92b2abb919307b1dbb9 by Andrew Svetlov (Bar 
Harel) in branch 'master':
bpo-32841: Fix cancellation in awaiting asyncio.Condition (#5665)
https://github.com/python/cpython/commit/5746510b7aef423fa4afc92b2abb919307b1dbb9


--

___
Python tracker 

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



Re: Django-hotsauce 1.0 commercial edition looking for beta testers!

2018-02-14 Thread Etienne Robillard

Hi Ned



Le 2018-02-13 à 19:54, Ned Batchelder a écrit :


There are a number of things that are confusing about this.  You 
should state clearly what django-hotsauce is. You say "Django 
alternative microframework."  Usually people use "Django" and 
"microframework" as opposites, not something you can combine together.
Sorry for being unclear. I meant "Django-based alternative 
microframework". :-)


I plan to commercialize a Django extension for allowing pragmatic and 
high-performance WSGI programming *on top* of Django.





You say there will be a free version.  Does it already exist? Link to it.

https://www.isotopesoftware.ca/software/django-hotsauce/
https://pypi.python.org/pypi/Django-hotsauce/0.9.0


Finally, you seem to be asking experts to volunteer their time to help 
you design and test software that you will then sell.  This seems 
unrealistic at best, and exploitive or unfair at worst.


Yes. I'm really looking for serious people and/or companies to 
try/test/review django-hotsauce 1.0 commercial edition for *commercial 
purposes* in exchange of a small fee.



--Ned.


Best regards,
Etienne

--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
https://mail.python.org/mailman/listinfo/python-list


[issue32841] Asyncio.Condition prevents cancellation

2018-02-14 Thread Bar Harel

Bar Harel  added the comment:

I don't think so. Having shield not cancel immediately but rather wait and
cancel will cause long timed shielded operations to stall the task
cancellation, usually for no good. This isn't the general case.
However, adding another function which does so might just be a good idea. I
think another parameter to shield to choose cancellation time will clutter
the function call.

On Wed, Feb 14, 2018, 7:28 AM Nathaniel Smith 
wrote:

>
> Nathaniel Smith  added the comment:
>
> It does make me wonder if asyncio.shield *should* wait for the thing it's
> shielding though, so that it *would* work in this case? (Similar to
> bpo-32751.)
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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