[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread Xiang Zhang

Xiang Zhang added the comment:

>   ./python -m test.regrtest test_unary -v test_binop
>   ./python -m test.regrtest test_unary -u all test_binop

These also fail in 3.6.0a4. You can only specify options after args now. 
test_binop is not valid option. Isn't this the expected behaviour?

--

___
Python tracker 

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



[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This issue is not specific to -x, but affects all options. Following lines work:

./python -m test.regrtest -v test_unary test_binop
./python -m test.regrtest -u all test_unary test_binop
./python -m test.regrtest test_unary test_binop -v
./python -m test.regrtest test_unary test_binop -u all

But following lines don't work:

./python -m test.regrtest test_unary -v test_binop
./python -m test.regrtest test_unary -u all test_binop

--

___
Python tracker 

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



[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread Xiang Zhang

Xiang Zhang added the comment:

So should we still consider this a regression? Actually -x is used as a hint 
flag and should not be used as -x arg pair. The right usage could still work 
now.

--

___
Python tracker 

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



[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread Xiang Zhang

Xiang Zhang added the comment:

This regression is introduced in 4df2d43e995d. 

And actually to skip multiple tests, you should use python3 -m test.regrtest -x 
test_venv test_gdb. Although Charalampos's example could work, it actually 
treats -x as a test.

--
nosy: +xiang.zhang

___
Python tracker 

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



Re: How to process syntax errors

2016-10-10 Thread Terry Reedy

On 10/10/2016 11:24 AM, Chris Angelico wrote:

On Tue, Oct 11, 2016 at 1:13 AM,   wrote:

Is there any way to capture syntax errors and process them ? I want to write a 
function which calls every time whenever there is syntax error in the program.



However, you can catch this at some form of outer level. If you're
using exec/eval to run the code, you can guard that:

code = """
obj = MyClass() # using PEP 8 names
obj xyz
"""
try:
exec(code)
except SyntaxError:
print("Blah blah blah")


Far from being 'un-pythonic' (Puneet's response), this is essentially 
what the interpreter does, either without or with a separate explicit 
compile step.  IDLE splits the exec into two pieces in two processes. 
Except for the two process part, this either uses or copies 
code.InteractiveInterpreter in the stdlib.  The fact that the latter 
separates compile and exec is what allows IDLE to subclass it and run 
the code object elsewhere, by over-riding the runcode method.


# in IDLE process:

code = 

try:
code_ob = compile(code, )
except (SyntaxError, ) as e:
  # replace ^ with red background highlight
else:


# in user process

exec(code, fake_main)
# stdout, stderr connect to IDLE process



--
Terry Jan Reedy

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


Re: Free Python e-books from O'Reilly

2016-10-10 Thread John Gordon
In  Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= 
 writes:

> http://www.oreilly.com/programming/free/

> Any of these good enough to bother getting? Yes, I know, they
> are for no pay but if not worth reading still a waste of time
> and memory space.

I downloaded several of them and noticed that they were all fairly short,
none more than 80 pages or so.  I suspect these books are somewhat lighter
fare than the typical O'Reilly tome.

Not necessarily a bad thing, but worth mentioning.

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

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


[issue28411] Eliminate PyInterpreterState.modules.

2016-10-10 Thread Graham Dumpleton

Graham Dumpleton added the comment:

I always use PyImport_GetModuleDict(). So long as that isn't going away I 
should be good.

--

___
Python tracker 

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



[issue28411] Eliminate PyInterpreterState.modules.

2016-10-10 Thread Nick Coghlan

Nick Coghlan added the comment:

(added Graham Dumpleton to the nosy list to ask if this change may impact 
mod_wsgi for 3.7)

+1 on the general idea, but given that the current field is a public part of 
the interpreter state, the replacement access API should really be public as 
well - we can't be sure folks will always be going through the 
"PyImport_GetModuleDict()" API.

If you replace the addition of the `_PyImport_GetModuleDict` API with a public 
`PyInterpreterState_GetModuleDict` API, I think that will cover it - the new 
calls would just be "PyInterpreterState_GetModuleCache(tstate->interp)" rather 
than `_PyImport_GetModuleDict(tstate)`

Folks accessing this field directly can then define their own shim function if 
PyInterpreterState_GetModuleCache isn't defined.

(The rationale for the GetModuleDict -> GetModuleCache change is that 
"ModuleDict" is ambiguous - every module has a dict. For PyImport_* we're stuck 
with it, but the "PyImport" prefix at least gives a hint that the reference 
might be to the sys.modules cache. That affordance doesn't exist for the 
"PyInterpeterState" prefix.

--
nosy: +grahamd

___
Python tracker 

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



[issue28208] update sqlite to 3.14.2

2016-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b7e068d6c53f by Zachary Ware in branch '3.6':
Issue #28208: Update Windows build to use SQLite 3.14.2.0
https://hg.python.org/cpython/rev/b7e068d6c53f

New changeset 3e329b553567 by Zachary Ware in branch 'default':
Issue #28208: Merge with 3.6
https://hg.python.org/cpython/rev/3e329b553567

--
nosy: +python-dev

___
Python tracker 

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



[issue28248] Upgrade installers to OpenSSL 1.0.2j

2016-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c29045efd25e by Zachary Ware in branch '2.7':
Issue #28248: Update Windows build to use OpenSSL 1.0.2j
https://hg.python.org/cpython/rev/c29045efd25e

New changeset d7b9ce8ae79b by Zachary Ware in branch '3.4':
Issue #28248: Update Windows build to use OpenSSL 1.0.2j
https://hg.python.org/cpython/rev/d7b9ce8ae79b

New changeset 5fa74d8c987b by Zachary Ware in branch '3.5':
Issue #28248: Merge with 3.4
https://hg.python.org/cpython/rev/5fa74d8c987b

New changeset cc5006dab787 by Zachary Ware in branch '3.6':
Issue #28248: Merge with 3.5
https://hg.python.org/cpython/rev/cc5006dab787

New changeset fea9ff9e745d by Zachary Ware in branch 'default':
Issue #28248: Merge with 3.6
https://hg.python.org/cpython/rev/fea9ff9e745d

--
nosy: +python-dev

___
Python tracker 

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



[issue28248] Upgrade installers to OpenSSL 1.0.2j

2016-10-10 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Hi, I updated the openssl version from 1.0.2h to 1.0.2j in build-installer.py

Please let me know if this works.

Thanks :)

--
keywords: +patch
nosy: +Mariatta
Added file: http://bugs.python.org/file45054/issue28248.patch

___
Python tracker 

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



[issue28208] update sqlite to 3.14.2

2016-10-10 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Hello,

Attached is the patch for updating sqlite version to 3.14.2.

Please review, and let me know if this works.

Thanks :)

--
keywords: +patch
nosy: +Mariatta
Added file: http://bugs.python.org/file45053/issue28208.patch

___
Python tracker 

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



[issue28410] Add convenient C API for "raise ... from ..."

2016-10-10 Thread Nick Coghlan

Nick Coghlan added the comment:

Serhiy, how does this version compare/relate to the previous discussion in 
http://bugs.python.org/issue23188 ?

--
nosy: +ncoghlan

___
Python tracker 

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



[issue13646] Document poor interaction between multiprocessing and -m on Windows

2016-10-10 Thread Nick Coghlan

Nick Coghlan added the comment:

These interactions were fixed in the release where *nix multiprocessing gained 
the ability to mimic the Windows behaviour.

--
resolution:  -> out of date
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



[issue28208] update sqlite to 3.14.2

2016-10-10 Thread Ned Deily

Ned Deily added the comment:

I'd like to see this in 3.6.0b3.

--

___
Python tracker 

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



[issue28248] Upgrade installers to OpenSSL 1.0.2j

2016-10-10 Thread Ned Deily

Ned Deily added the comment:

We didn't get this into 3.6.0b2; needs to be in 3.6.0b3.

--

___
Python tracker 

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



[RELEASE] Python 3.6.0b2 is now available

2016-10-10 Thread Ned Deily
On behalf of the Python development community and the Python 3.6 release
team, I'm happy to announce the availability of Python 3.6.0b2. 3.6.0b2
is the second of four planned beta releases of Python 3.6, the next major
release of Python, and marks the end of the feature development phase
for 3.6.

Among the new major new features in Python 3.6 are:

* PEP 468 - Preserving the order of **kwargs in a function
* PEP 487 - Simpler customization of class creation
* PEP 495 - Local Time Disambiguation
* PEP 498 - Literal String Formatting
* PEP 506 - Adding A Secrets Module To The Standard Library
* PEP 509 - Add a private version to dict
* PEP 515 - Underscores in Numeric Literals
* PEP 519 - Adding a file system path protocol
* PEP 520 - Preserving Class Attribute Definition Order
* PEP 523 - Adding a frame evaluation API to CPython
* PEP 524 - Make os.urandom() blocking on Linux (during system startup)
* PEP 525 - Asynchronous Generators (provisional)
* PEP 526 - Syntax for Variable Annotations (provisional)
* PEP 528 - Change Windows console encoding to UTF-8 (provisional)
* PEP 529 - Change Windows filesystem encoding to UTF-8 (provisional)
* PEP 530 - Asynchronous Comprehensions

Please see "What’s New In Python 3.6" for more information:

https://docs.python.org/3.6/whatsnew/3.6.html

You can find Python 3.6.0b2 here:

https://www.python.org/downloads/release/python-360b2/

Beta releases are intended to give the wider community the opportunity
to test new features and bug fixes and to prepare their projects to
support the new feature release. We strongly encourage maintainers of
third-party Python projects to test with 3.6 during the beta phase and
report issues found to bugs.python.org as soon as possible. While the
release is feature complete entering the beta phase, it is possible that
features may be modified or, in rare cases, deleted up until the start
of the release candidate phase (2016-12-05). Our goal is have no changes
after rc1. To achieve that, it will be extremely important to get as
much exposure for 3.6 as possible during the beta phase. Please keep in
mind that this is a preview release and its use is not recommended for
production environments

The next planned release of Python 3.6 will be 3.6.0b3, currently
scheduled for 2016-10-31. More information about the release schedule
can be found here:

https://www.python.org/dev/peps/pep-0494/

--
  Ned Deily
  n...@python.org -- []

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


[issue28410] Add convenient C API for "raise ... from ..."

2016-10-10 Thread Emanuel Barry

Changes by Emanuel Barry :


--
nosy: +ebarry

___
Python tracker 

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



[issue28334] netrc does not work if $HOME is not set

2016-10-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

FWIW, some history: The $HOME lookup was in Guido's original 1998-12-22 patch:
if not file:
file = os.path.join(os.environ['HOME'], ".netrc")
The lookup was wrapped in try-except 4 years later to give a 'consistent error 
message'.

Module ntpath dates back to 1994.  Expanduser only used HOMEDRIVE and HOMEPATH. 
 Guido added support for HOME in 1997.  Support for USERPROFILE was added a 
decade later.

Since the module is NOT marked 'Unix-only', I think it a bug to not use 
os.path.expanduser.  Larry, Ned, do either of you have an opinion on whether 
the change should be made in current versions or only 3.7?

--

___
Python tracker 

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



[issue28412] os.path.splitdrive documentation out of date

2016-10-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue28412] os.path.splitdrive documentation out of date

2016-10-10 Thread Michael Partridge

New submission from Michael Partridge:

ntpath.splitdrive was updated in patch 26ec6248ee8b. (I think this was released 
in 2.7.8.)

This changes the behaviour of splitdrive for UNC style paths. Previously:

>>> ntpath.splitdrive(r'\\nancy\foo\bar')
('', 'nancy\\foo\\bar') 
 
>>> 

Now:
>>> ntpath.splitdrive(r'\\nancy\foo\bar')
('nancy\\foo', '\\bar')
>>> 

The documentation should be updated to say the same.

--
assignee: docs@python
components: Documentation
messages: 278446
nosy: docs@python, snooter
priority: normal
severity: normal
status: open
title: os.path.splitdrive documentation out of date
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue28411] Eliminate PyInterpreterState.modules.

2016-10-10 Thread Eric Snow

New submission from Eric Snow:

tl;dr PyInterpreterState does not need a "modules" field.  Attached is a patch 
that removes it.

During interpreter startup [1] the sys module is imported using the same C API 
[2] as any other builtin module.  That API only requires one bit of import 
state, sys.modules.  Obviously, while the sys module is being imported, 
sys.modules does not exist yet.  To accommodate this situation, 
PyInterpreterState has a "modules" field.  The problem is that 
PyInterpreterState.modules remains significant in the C-API long after it is 
actually needed during startup.  This creates the potential for sys.modules and 
PyInterpreterState.modules to be out of sync.

Currently I'm working on an encapsulation of the import state.  
PyInterpreterState.modules complicates the scene enough that I'd like to see it 
go away.  The attached patch does so by adding private C-API functions that 
take a modules arg, rather than getting it from the interpreter state.  These 
are used during interpreter startup, rendering PyInterpreterState.modules 
unnecessary and allowing sys.modules to become the single source of truth.

If this patch lands, we can close issue12633.


[1] see _Py_InitializeEx_Private() and Py_NewInterpreter() in 
Python/pylifecycle.c
[2] see PyModule_Create2() and _PyImport_FindBuiltin() in Python/import.c

--
components: Interpreter Core
files: drop-interp-modules.diff
keywords: patch
messages: 278445
nosy: brett.cannon, eric.snow, ncoghlan
priority: normal
severity: normal
stage: patch review
status: open
title: Eliminate PyInterpreterState.modules.
versions: Python 3.7
Added file: http://bugs.python.org/file45052/drop-interp-modules.diff

___
Python tracker 

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



Re: Free Python e-books from O'Reilly

2016-10-10 Thread Uri Even-Chen
I think it's good that so many free books are about Python, more than any
other specific programming language. But I haven't read any of them yet.


*Uri Even-Chen*
[image: photo] Phone: +972-54-3995700
Email: u...@speedy.net
Website: http://www.speedysoftware.com/uri/en/
  
    

On Tue, Oct 11, 2016 at 12:03 AM, Martin Schöön 
wrote:

> http://www.oreilly.com/programming/free/
>
> Any of these good enough to bother getting? Yes, I know, they
> are for no pay but if not worth reading still a waste of time
> and memory space.
>
> /Martin
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> fixed
stage: commit 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



Raster top and lowe x,y how ca i get

2016-10-10 Thread Xristos Xristoou
How can i get left lower X,Y left top X,Y right lower X,Y and right Top X,Y  
from a raster image like dem(digital elevation model).
I am nembie sorry if i have stupid quest
-- 
https://mail.python.org/mailman/listinfo/python-list


Free Python e-books from O'Reilly

2016-10-10 Thread Martin Schöön
http://www.oreilly.com/programming/free/

Any of these good enough to bother getting? Yes, I know, they
are for no pay but if not worth reading still a waste of time
and memory space.

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


[issue28230] tarfile does not support pathlib

2016-10-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It seems to me that tarfile already supports path protocol for all external 
patches and no changes for tarfile are needed.

Proposed patch adds tests for (already implemented) support of pathlike 
protocol in tarfile.

--
Added file: http://bugs.python.org/file45051/test_tarfile_pathlike.patch

___
Python tracker 

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



[issue28404] Logging SyslogHandler not appending '\n' to the end

2016-10-10 Thread Vinay Sajip

Vinay Sajip added the comment:

> So I think it must be a Fluentd error.

So I'll close this.

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



Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread breamoreboy
On Monday, October 10, 2016 at 5:25:46 PM UTC+1, Nuen9 wrote:
> > Hi!
> > 
> > Could it be, "Nuen9", that you would like to find a split where the 
> > split sums are close to each other? In other words, you define the 
> > number of splits (in your example: 3) and the algortihm should test all 
> > possible combinations and select the split where the sum differences are 
> > smallest.
> > 
> > Best,
> > Kimmo
> 
> Yes it is, I want example python code for finding my answers but I don't code 
> my answers. please help me.

Awfully sorry but we don't write your code for you.  I suggest that you read 
any Python tutorial and try running code at an interactive prompt, then when 
you run into problems ask a specific question about a specific problem.

Kindest regards.

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


Re: How to process syntax errors

2016-10-10 Thread breamoreboy
On Monday, October 10, 2016 at 3:15:40 PM UTC+1, mr.pune...@gmail.com wrote:
> Hi 
> 
> Is there any way to capture syntax errors and process them ? I want to write 
> a function which calls every time whenever there is syntax error in the 
> program.
> 
> For example, 
> 
> inside example.py 
> 
> I just mention below line 
> 
> 
> Obj = myClass()
> Obj xyz
> 
> Obj is instance of a class. But there is syntax error on xyz. So I want to 
> grab that error and process.
> 
> Regards, Puneet

Simple, catch it in your IDE, no need to try and get clever.

Kindest regards.

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


Re: Newbie Need Help On Regex!

2016-10-10 Thread breamoreboy
On Monday, October 10, 2016 at 3:58:56 PM UTC+1, infos...@gmail.com wrote:
> Hey guys!
>  
> I am new to learning regex in python and I'm wondering how do I use regex in 
> python to store the integers(positive and negative) i want into a list!
>  
> For e.g.
>  
> This is the data in a list.
>  
> [u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=-5,B=5)', 
> u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=5,Y=5)', 
> u'\x1b[0m[\x1b[1m\x1b[10m\xbb\x1b[0m\x1b[36m]\x1b[0m : ']
>  
> How do I extract the values of A and B and store them in a variable I want 
> using regex?
>  
> Thank you and appreciate it :)

What makes you think you need a regex?  Why don't you write some code and when 
you have problems, post it here.  Then we'll give you some answers.

Kindest regards.

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


[issue26869] unittest longMessage docs

2016-10-10 Thread Thomas Guettler

Thomas Guettler added the comment:

@Mariatta thank you very much. This update makes the docs easy to read and 
understand. Thank you :-)

--

___
Python tracker 

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



[issue28214] Improve exception reporting for problematic __set_name__ attributes

2016-10-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +Add convenient C API for "raise ... from ..."

___
Python tracker 

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



[issue28410] Add convenient C API for "raise ... from ..."

2016-10-10 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Sometimes after catching an exception we need to raise new exception of 
specific type, but save the information about current exception. In Python the 
syntax "raise ... from ..." serves this purpose (PEP 3134). But in C the code 
that implements this is too cumbersome. Proposed patch adds private convenient 
function that raises an exception and sets previously raised exception as its 
__context__ and __cause__ attributes. This is a generalized version of 
gen_chain_runtime_error() from Objects/genobject.c. It could be reused in three 
other places: Objects/abstract.c, Objects/unicodeobject.c, and 
Modules/zipimport.c (currently only __context__ is set, but setting __cause__ 
looks preferable), and in new code for issue28214. Maybe there are other 
opportunities.

--
components: Interpreter Core
files: _PyErr_FormatFromCause.patch
keywords: patch
messages: 278441
nosy: haypo, serhiy.storchaka, yselivanov
priority: normal
severity: normal
stage: patch review
status: open
title: Add convenient C API for "raise ... from ..."
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45050/_PyErr_FormatFromCause.patch

___
Python tracker 

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



[issue28404] Logging SyslogHandler not appending '\n' to the end

2016-10-10 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue2897] Deprecate structmember.h

2016-10-10 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
assignee: docs@python -> belopolsky
stage: patch review -> commit review

___
Python tracker 

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



[issue28314] ElementTree: Element.getiterator(tag) broken in 3.6

2016-10-10 Thread Ned Deily

Changes by Ned Deily :


--
stage: needs patch -> patch review

___
Python tracker 

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



[issue28230] tarfile does not support pathlib

2016-10-10 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +lars.gustaebel

___
Python tracker 

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



[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread R. David Murray

R. David Murray added the comment:

That sounds like a regression in argparse that we'd better track down.

--
nosy: +larry, ned.deily, r.david.murray
priority: normal -> release blocker

___
Python tracker 

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



[issue20215] socketserver.TCPServer can not listen IPv6 address

2016-10-10 Thread Jason R. Coombs

Changes by Jason R. Coombs :


--
nosy: +jason.coombs

___
Python tracker 

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



[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Seems this is related to some changes in argparse.

--
nosy: +bethard, serhiy.storchaka
versions: +Python 3.5

___
Python tracker 

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



[issue28334] netrc does not work if $HOME is not set

2016-10-10 Thread Dimitri Merejkowsky

Dimitri Merejkowsky added the comment:

> if it make sense to run this on Windows

I found this issue while running cross-platform code. I needed to store some 
credentials, did not mind having them in plain-text and I thought .netrc was a 
good place for this. (did not need to re-invent the wheel ...)

>  don't know what unix users might reasonbly expect.

Well, I guess as a bonus of this patch we could add a link to the 
`os.path.expanduser` section[1] in `netrc` documentation.

The behavior when $HOME is not set is properly documented there.

[1] https://docs.python.org/3/library/os.path.html#os.path.expanduser

--

___
Python tracker 

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



[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +haypo
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.7

___
Python tracker 

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



[issue20463] sqlite dumpiter dumps invalid script when virtual tables are used

2016-10-10 Thread Aviv Palivoda

Aviv Palivoda added the comment:

Attached is patch with a fix for this issue. This is not as comprehensive as 
the solution in apsw but I think this should cover most of the cases. The 
result for Ronny dump after this fix is:

BEGIN TRANSACTION;
PRAGMA writable_schema=ON;
INSERT INTO 
sqlite_master(type,name,tbl_name,rootpage,sql)VALUES('table','test','test',0,'CREATE
 VIRTUAL TABLE test using fts4(example)');
CREATE TABLE 'test_content'(docid INTEGER PRIMARY KEY, 'c0example');
CREATE TABLE 'test_docsize'(docid INTEGER PRIMARY KEY, size BLOB);
CREATE TABLE 'test_segdir'(level INTEGER,idx INTEGER,start_block 
INTEGER,leaves_end_block INTEGER,end_block INTEGER,root BLOB,PRIMARY KEY(level, 
idx));
CREATE TABLE 'test_segments'(blockid INTEGER PRIMARY KEY, block BLOB);
CREATE TABLE 'test_stat'(id INTEGER PRIMARY KEY, value BLOB);
PRAGMA writable_schema=OFF;
COMMIT;

--
keywords: +patch
nosy: +palaviv
Added file: http://bugs.python.org/file45049/20463.patch

___
Python tracker 

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



Re: How to process syntax errors

2016-10-10 Thread BartC

On 10/10/2016 16:44, Pierre-Alain Dorange wrote:

Chris Angelico  wrote:


Yes and no. Syntax errors are detected when the script is compiled, so
you can't do something like this:


You're right, except that Python is never compiled, it was just checked
for syntax error before interpreting code.


In the case of CPython, source code is compiled into byte-code before 
it's interpreted. Part of that process is detecting syntax errors.


AFAIK, this is usually done a module at a time (convert an entire module 
to byte-code, then start interpreting). It might be a little different 
with functions such as eval and exec.


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


[issue28179] Segfault in test_recursionlimit_fatalerror

2016-10-10 Thread Ned Deily

Ned Deily added the comment:

Since this is also reproducible on some 3.5.2 platforms, I don't think it 
qualifies as a release blocker for 3.6.0.  But it still should be addressed.

--
priority: release blocker -> high

___
Python tracker 

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



[issue28409] test.regrtest does not support multiple -x flags

2016-10-10 Thread Charalampos Stratakis

New submission from Charalampos Stratakis:

Until python3.6.0a04 it was possible to pass multiple times the -x option at 
regrtest.

However since the 3.6.0b1 when trying the same thing I get an error. Test names 
are random.

python3 -m test.regrtest -x test_venv -x test_gdb
usage: python -m test [options] [test_name1 [test_name2 ...]]
python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
regrtest.py: error: unrecognized arguments: test_gdb

If however I omit the second -x, the tests run fine and correctly exclude the 
specific tests.

Was the change intentional or a side effect from something else?

--
components: Tests
messages: 278435
nosy: cstratak
priority: normal
severity: normal
status: open
title: test.regrtest does not support multiple -x flags
versions: Python 3.6

___
Python tracker 

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



Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread K. Elo

Hi!

Here one possible solution:

--- snip ---

land = [10,20,30,40,110,50,18,32,5]

landlength=len(land)
winnersplit=[]

for i in range(landlength-2):
for j in range(landlength-1-i):
splitsums=[sum(land[0:(i+1)]), sum(land[(i+1):(i+j+2)]), 
sum(land[(i+j+2):landlength])]


differences=abs(splitsums[1]-splitsums[0])+abs(splitsums[2]-splitsums[1])

if (len(winnersplit)==0 or 
differences<(abs(sum(winnersplit[1])-sum(winnersplit[0]))+abs(sum(winnersplit[2])-sum(winnersplit[1]:
winnersplit=[land[0:(i+1)], land[(i+1):(i+j+2)], 
land[(i+j+2):landlength]]

print(splitsums," <<< WE HAVE A NEW LEADER! >>>")
else:
print(splitsums, " <<< split differences too large :( >>>")

print("And the winner is ... ", winnersplit)

--- snip ---

HTH,
Kimmo

10.10.2016, 19:25, Nuen9 kirjoitti:

Hi!

Could it be, "Nuen9", that you would like to find a split where the
split sums are close to each other? In other words, you define the
number of splits (in your example: 3) and the algortihm should test all
possible combinations and select the split where the sum differences are
smallest.

Best,
Kimmo


Yes it is, I want example python code for finding my answers but I don't code 
my answers. please help me.


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


[issue28328] statistics.geometric_mean has no tests. Defer to 3.7?

2016-10-10 Thread Ned Deily

Changes by Ned Deily :


--
priority: release blocker -> normal

___
Python tracker 

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



[issue28408] Fix redundant code and memory leak in _PyUnicodeWriter_Finish

2016-10-10 Thread Xiang Zhang

New submission from Xiang Zhang:

_PyUnicodeWriter_Finish gets 2 problems now:

1. It has two same branches handling empty strings which is redundant.

2. It may leak the inner buffer object when resize_compact fails. When 
resize_compact fails, the buffer object is left untouched. Then the writer 
itself is freed and the buffer is leaked.

--
components: Interpreter Core
files: _PyUnicodeWriter_Finish.patch
keywords: patch
messages: 278434
nosy: haypo, serhiy.storchaka, xiang.zhang
priority: normal
severity: normal
stage: patch review
status: open
title: Fix redundant code and memory leak in _PyUnicodeWriter_Finish
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45048/_PyUnicodeWriter_Finish.patch

___
Python tracker 

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



[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a8dd18e375c8 by INADA Naoki in branch '3.6':
Issue #28405: Fix compile error for _futuresmodule.c on Cygwin.
https://hg.python.org/cpython/rev/a8dd18e375c8

New changeset d2a313d13542 by INADA Naoki in branch 'default':
Issue #28405: Fix compile error for _futuresmodule.c on Cygwin.
https://hg.python.org/cpython/rev/d2a313d13542

--
nosy: +python-dev

___
Python tracker 

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



[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread Ned Deily

Ned Deily added the comment:

revised patch LGTM

--
nosy: +ned.deily

___
Python tracker 

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



[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread INADA Naoki

INADA Naoki added the comment:

Oh! Thanks, While I ran make, I had missed error message somehow.

--

___
Python tracker 

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



[issue28407] Improve coverage of email.utils.make_msgid()

2016-10-10 Thread Dillon Brock

New submission from Dillon Brock:

There were 2 lines of email.utils.make_msgid() that were not covered (lines 202 
and 204 of Lib/email/utils.py), so I wrote a quick patch to cover them.

--
components: Tests, email
files: make_msgid_coverage.patch
keywords: patch
messages: 278430
nosy: barry, dillon.brock, r.david.murray
priority: normal
severity: normal
status: open
title: Improve coverage of email.utils.make_msgid()
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file45047/make_msgid_coverage.patch

___
Python tracker 

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



[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

Thanks, INADA.
I confirmed your solution, and has succeeded to build _futures extension. Your 
patch has a little misspell. I fixed it.

--
Added file: http://bugs.python.org/file45046/gc_track-2.patch

___
Python tracker 

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



Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread Emile van Sebille

On 10/10/2016 09:25 AM, Nuen9 wrote:

Hi!

Could it be, "Nuen9", that you would like to find a split where the
split sums are close to each other? In other words, you define the
number of splits (in your example: 3) and the algortihm should test all
possible combinations and select the split where the sum differences are
smallest.

Best,
Kimmo


Yes it is, I want example python code for finding my answers but I don't code 
my answers. please help me.



Here's one way:

n=3
land = [10,20,30,40,110,50,18,32,5]
lsum = sum(land)
lavg = lsum/n
close = lavg/n
idx = 0
lnsums = [0]*n
ln=0
while idx < len(land) and ln lavg-close:
ln+=1

print lnsums


--

Emile


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


[issue28230] tarfile does not support pathlib

2016-10-10 Thread Ethan Furman

Ethan Furman added the comment:

As Serhiy was alluding to, if the incoming path is for the actual tar file and 
is only passed along to Python itself then we probably don't need to worry 
about os.fspath().  For names that will be interally stored, or are for 
accessing internal files, then the proper sequence is check for and call 
os.fspath if necessary, and then double-check that the name to be used is a 
str.  The double-check is needed because os.fspath may return a bytes object, 
which tar does not allow.

--

___
Python tracker 

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



Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread Nuen9
> Hi!
> 
> Could it be, "Nuen9", that you would like to find a split where the 
> split sums are close to each other? In other words, you define the 
> number of splits (in your example: 3) and the algortihm should test all 
> possible combinations and select the split where the sum differences are 
> smallest.
> 
> Best,
> Kimmo

Yes it is, I want example python code for finding my answers but I don't code 
my answers. please help me. 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28406] Possible PyUnicode_InternInPlace() edge-case bug

2016-10-10 Thread INADA Naoki

INADA Naoki added the comment:

I think the comment described "Why Py_ALLOW_RECURSION is required", not "t may 
be NULL even if s is in the intern dict".

> If PyDict_GetItem fails due to stack overflow, perhaps the Python process is 
> doomed to fail soon anyway.

When I changed the code to use PyDict_SetDefault(), I found "USE_STACKCHECK" 
macro.
See https://docs.python.org/3/c-api/sys.html#c.PyOS_CheckStack

But I don't know this can be really happend. Interned dict only contains exact 
unicode objects. There is no chance for
calling user defined __hash__() or __eq__().

--
nosy: +inada.naoki

___
Python tracker 

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



Re: PyQT - Signals and Slots?

2016-10-10 Thread Michael Torrie
On 10/10/2016 07:32 AM, Veek M wrote:
> Whaaa...t?? Could someone explain what exactly is his grand design 
> besides being awfully circuitous? So he has some other Form thingy.. and 
> in that he sets up another mapping from ZeroSpinBox.atzero --> 
> ZeroSpinBox.announce  where's announce and atzero defined?

In your example code, "atzero" is implicitly defined as a signal in the
connect() call.  Under the hood in Qt, signals are all dispatched by
strings when you emit() the signal.  PyQt does allow you to define
signals in a more pythonic way using class variables:

class Foo(QWidget):
atzero = SIGNAL( signature )

The signature can be a list of python types, or strings describing the
C++ types.  This is where the C++ nature of Qt leaks into PyQt.  In C++
since the moc compiler takes C++ code and C++ type names and generates a
meta-class that defines signals in terms of strings (moc does basic
compile-time type checking), in Python we also have to provide
signatures in strings also if we need something more than core python
types (int, bool, etc).  This signature helps PyQt (well Qt really)
marshal the types properly when the signal's callback is called.

But yes the example is convoluted and circuitous.  I think it's just to
demonstrate how signals and slots work, though.  That's what the
comments make clear.  This isn't how you'd implement a real widget with
customized behavior.

In general I don't think widgets normally want to catch their own
signals.  There are other mechanisms for that.  Usually you subclass the
widget and then override the appropriate *Event() method. For example,
to do something special on value changes I believe you'd subclass
QSpinBox and override the changeEvent() method. Inside that you would
get your value, do your logic, and potentially emit a custom signal. And
of course calling the parent changeEvent() to propagate the event
through to the parent class.


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


Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread Nuen9
เมื่อ วันจันทร์ที่ 10 ตุลาคม ค.ศ. 2016 22 นาฬิกา 46 นาที 33 วินาที UTC+7, K. 
Elo เขียนว่า:
> Hi!
> 
> Could it be, "Nuen9", that you would like to find a split where the 
> split sums are close to each other? In other words, you define the 
> number of splits (in your example: 3) and the algortihm should test all 
> possible combinations and select the split where the sum differences are 
> smallest.
> 
> Best,
> Kimmo
> 
> 10.10.2016, 18:20, Nuen9 wrote:
> > เมื่อ วันจันทร์ที่ 10 ตุลาคม ค.ศ. 2016 21 นาฬิกา 31 นาที 25 วินาที UTC+7, 
> > Steve D'Aprano เขียนว่า:
> >> On Tue, 11 Oct 2016 12:38 am, amornsak@gmail.com wrote:
> > I'm sorry for my English language.
> >
> > OK, I have list = [10,20,30,40,110,50,18,32,5] and want to find three 
> > values of summation from my list by split any way list but three values of 
> > summation has closely
> > example.
> > [10,20,30], [40,110,50], [18,32,5] = 60, 200, 55 -> it is not closely
> > *** 60 = 10+20+30, 200 = 40+110+50, 18+32+5 = 55
> > and [10], [20,30,40,110,50,18], [32,5]  = 10, 268, 37 -> and it is not 
> > closely
> > and [10,20,30,40],[110],[50,18,32,5] = 100,110,105 -> it's closely
> >
> > The Really answers that I want is [10,20,30,40],[110],[50,18,32,5] = 
> > 100,110,105 from list[10,20,30,40,110,50,18,32,5]
> >
> > And I don't know what I have to explain for my questions in English because 
> > My English so bad T_T
> >
> > Thank you for reading my text
> >
> > (;
> >

Yes it is, I want example python code for finding my answers but I don't code 
my answers. please help me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to process syntax errors

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 2:44 AM, Pierre-Alain Dorange
 wrote:
> Chris Angelico  wrote:
>
>> Yes and no. Syntax errors are detected when the script is compiled, so
>> you can't do something like this:
>
> You're right, except that Python is never compiled, it was just checked
> for syntax error before interpreting code.

https://docs.python.org/3/library/functions.html#compile

It's compiled.

>> However, you can catch this at some form of outer level. If you're
>> using exec/eval to run the code, you can guard that:
>
> Your solution are OK, but that's not very "pythonic".
>
> Python was not design to be used in such a way (intercepting syntax
> error). There was hack to made somthing like requested but that only a
> hack and should not be used in real world.

The error is raised as an exception, which means it is most definitely
meant to be able to be caught. If it were utterly and completely
fatal, it would simply be handled as "print message to standard error,
terminate process" as some forms of fatal error are. (But even in some
of those cases - SystemError and MemoryError - they can still be
raised as exceptions.)

There's nothing unpythonic about catching an exception if you know how
to handle it. My examples did have somewhat unpythonic behaviour
(catching an exception only to print a message and continue), but
that's because they're placeholders.

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


[issue28406] Possible PyUnicode_InternInPlace() edge-case bug

2016-10-10 Thread Larry Hastings

Larry Hastings added the comment:

Ah, indeed.  My mistake--I'm working in the Gilectomy branch, which is 
hilariously out of date.  (It's stuck in February 2016.)

The new version using PyDict_SetDefault() won't have *this* specific problem.  
Perhaps later I'll read the new code and see if I can spot a similar problem.  
But for now it only makes sense to close this issue.

--
resolution:  -> fixed
stage: test needed -> 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



[issue27761] Private _nth_root function loses accuracy

2016-10-10 Thread Ned Deily

Changes by Ned Deily :


--
priority: release blocker -> normal

___
Python tracker 

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



[issue28406] Possible PyUnicode_InternInPlace() edge-case bug

2016-10-10 Thread Xiang Zhang

Xiang Zhang added the comment:

The code has already been changed in #27454.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue24459] Mention PYTHONFAULTHANDLER in the man page

2016-10-10 Thread Joshua Jay Herman

Joshua Jay Herman added the comment:

Thanks for reviewing Mariatta I have made a new patch that has those typos 
corrected.

--
Added file: 
http://bugs.python.org/file45045/correctedRebasedAddMissingEnvironmentalVariables.patch

___
Python tracker 

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



[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread INADA Naoki

INADA Naoki added the comment:

I need another LGTM from core developer before committing.
Yury, could you see it?  This is one line patch.

--

___
Python tracker 

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



[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread INADA Naoki

INADA Naoki added the comment:

Thank you for reporting.

C-API doc 
[https://docs.python.org/3.7/c-api/gcsupport.html#c._PyObject_GC_TRACK] says:

> A macro version of PyObject_GC_Track(). It should not be used for extension 
> modules.

So simply replacing it to PyObject_GC_Track() may solve the issue.

--
assignee:  -> inada.naoki
priority: normal -> high
stage:  -> commit review
Added file: http://bugs.python.org/file45044/28045-gc_track.patch

___
Python tracker 

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



Re: PyQT - Signals and Slots?

2016-10-10 Thread Veek M
Mark Summerfield wrote:

> 
> The ZeroSpinBox is a tiny example designed to show how the signal/slot
> mechanism works. It is just a QSpinBox with the addition of
> remembering how many times (all the) ZeroSpinBox(es) have had a 0
> value.
> 
> Nowadays the connections would be made with a new improved syntax:
> 
> self.connect(self, SIGNAL("valueChanged(int)"), self.checkzero) # OLD
> self.valueChanged.connect(self.checkzero) # NEW
> # or
> self.valueChanged[int].connect(self.checkzero) # NEW
> 
> Similarly the emit:
> self.emit(SIGNAL("atzero"), self.zeros) # OLD
> self.atzero.emit(self.zeros) # NEW
> 
> What's happening inside ZeroSpinBox? Whenever its value is set to 0 it
> calls its own checkzero() method, and this in turn emits an atzero
> signal with the number of zeros so far. Why does it do this? Just to
> show the mechanism. It doesn't matter whether you connect a widget to
> itself (unusual but done here), or to another widget (the norm).
> 
> See the book's website https://www.qtrac.eu/pyqtbook.html
> for all the source code including some updated with the new syntax.
> (But the book is old, so even the Python 3.1 examples aren't as
> Pythonic as they would be written in Python 3.4+.)

ah - okay, so i was on the right track - thanks :) cool that you hang 
out here :) 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread K. Elo

Hi!

Could it be, "Nuen9", that you would like to find a split where the 
split sums are close to each other? In other words, you define the 
number of splits (in your example: 3) and the algortihm should test all 
possible combinations and select the split where the sum differences are 
smallest.


Best,
Kimmo

10.10.2016, 18:20, Nuen9 wrote:

เมื่อ วันจันทร์ที่ 10 ตุลาคม ค.ศ. 2016 21 นาฬิกา 31 นาที 25 วินาที UTC+7, Steve 
D'Aprano เขียนว่า:

On Tue, 11 Oct 2016 12:38 am, amornsak@gmail.com wrote:

I'm sorry for my English language.

OK, I have list = [10,20,30,40,110,50,18,32,5] and want to find three values of 
summation from my list by split any way list but three values of summation has 
closely
example.
[10,20,30], [40,110,50], [18,32,5] = 60, 200, 55 -> it is not closely
*** 60 = 10+20+30, 200 = 40+110+50, 18+32+5 = 55
and [10], [20,30,40,110,50,18], [32,5]  = 10, 268, 37 -> and it is not closely
and [10,20,30,40],[110],[50,18,32,5] = 100,110,105 -> it's closely

The Really answers that I want is [10,20,30,40],[110],[50,18,32,5] = 
100,110,105 from list[10,20,30,40,110,50,18,32,5]

And I don't know what I have to explain for my questions in English because My 
English so bad T_T

Thank you for reading my text

(;


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


Re: How to process syntax errors

2016-10-10 Thread Pierre-Alain Dorange
Chris Angelico  wrote:

> Yes and no. Syntax errors are detected when the script is compiled, so
> you can't do something like this:

You're right, except that Python is never compiled, it was just checked
for syntax error before interpreting code.

> 
> However, you can catch this at some form of outer level. If you're
> using exec/eval to run the code, you can guard that:

Your solution are OK, but that's not very "pythonic".

Python was not design to be used in such a way (intercepting syntax
error). There was hack to made somthing like requested but that only a
hack and should not be used in real world.

-- 
Pierre-Alain Dorange   Moof 

Ce message est sous licence Creative Commons "by-nc-sa-2.0"

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


[issue28406] Possible PyUnicode_InternInPlace() edge-case bug

2016-10-10 Thread Larry Hastings

New submission from Larry Hastings:

A visual inspection of PyUnicode_InternInPlace() suggests there might be a rare 
edge-case bug lurking there.

Specifically, the bug has to do with "interned mortal" strings.  Interned 
mortal strings are stored in the static "interned" dictionary, with their key 
and value set to the same string.  (If "x" is interned, then in the interned 
dictionary "x" is set to "x".)  Under normal circumstances, these two 
references would keep the string alive forever.  However, in order for the 
string to be *mortal*, the unicode object then DECREFs the string twice so the 
references in the "interned" dict no longer "count".  When the refcnt reaches 
0, and the string is being destroyed, unicode_dealloc() temporarily resurrects 
the object, bumping its reference count up to 3.  It then removes the string 
from the interned dict and destroys it as normal.

The actual intern substitution happens in a function called 
PyUnicode_InternInPlace().  This function looks the string up in the "interned" 
dictionary, and if the string is there it substitutes in the interned version 
from the dictionary.  There's a curious comment in that function:

/* It might be that the GetItem call fails even
   though the key is present in the dictionary,
   namely when this happens during a stack overflow. */
Py_ALLOW_RECURSION
t = PyDict_GetItem(interned, s);
Py_END_ALLOW_RECURSION

If t is NULL, then PyUnicode_InternInPlace() goes on to set t in the interned 
dictionary, reduces the refcnt by 2, etc etc.

The problem: if t is in the dictionary, but PyDict_GetItem() fails (during a 
stack overflow?), then the subsequent PyDict_SetItem() will *overwrite* the 
existing interned string.  Which means the "interned" dict will drop its two 
references, which means two REFCNTs.  If there were only 1 or 2 extant 
references to this string, it means the string will be immediately dealloc'd, 
*even though the string was still in use*.

I suppose this is already such a speculative condition that it's probably not 
worrying over.  If PyDict_GetItem fails due to stack overflow, perhaps the 
Python process is doomed to fail soon anyway.  Perhaps PyDict_SetItem has no 
chance of working.  But it *seems* like this code is intended to function 
correctly even when PyDict_GetItem fails due to stack overflow, and I suspect 
it won't.

--
components: Interpreter Core
messages: 278421
nosy: larry
priority: low
severity: normal
stage: test needed
status: open
title: Possible PyUnicode_InternInPlace() edge-case bug
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



Re: Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread Nuen9
เมื่อ วันจันทร์ที่ 10 ตุลาคม ค.ศ. 2016 21 นาฬิกา 31 นาที 25 วินาที UTC+7, Steve 
D'Aprano เขียนว่า:
> On Tue, 11 Oct 2016 12:38 am, amornsak@gmail.com wrote:
> 
> > I have a list is
> > 
> > land = [10,20,30,40,110,50,18,32,5]
> > 
> > and I want to find each values of summation (don't sorted values in list)
> > as It has highest as possible
> > 
> > example.
> > 
> > I want to dividing N=3 part from list as above and divieded each part has
> > highest values that as possible. *** (don't sorted values in list)
> > 
> > first part has values is = 10, 20, 30, 40
> > summation = 10+20+30+40 = 100
> 
> Why do you add four numbers? Why not add all the numbers?
> 
> 10+20+30+40+110+50+18+32+5 = 315
> 
> > second part has values is = 110
> > summation = 110
> 
> Why do you only take one number?
> 
> 
> > and third part has values is = 50, 18, 32, 5
> > summation = 105
> 
> Why do you take four numbers?
> 
>  
> > that 100, 110 and 105 is highest values as possible in list by dividing
> > N=3 part.
> 
> I do not understand, what do you mean "dividing N=3 part"?
> 
> Could you do this?
> 
> [10,20,30,40,110,50,18,32,5]
> 
> split into three lists:
> 
> [10,20,30,40,110,50,18], [32], [5]
> 
> Or these three lists:
> 
> [10], [20,30,40,110,50,18], [32,5]
> 
> Or these three lists:
> 
> [10,20,30], [40,110,50], [18,32,5]
> 
> How do you split the list into three?
> 
> 
> 
> 
> 
> 
> -- 
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.

I'm sorry for my English language. 

OK, I have list = [10,20,30,40,110,50,18,32,5] and want to find three values of 
summation from my list by split any way list but three values of summation has 
closely
example.
[10,20,30], [40,110,50], [18,32,5] = 60, 200, 55 -> it is not closely
*** 60 = 10+20+30, 200 = 40+110+50, 18+32+5 = 55
and [10], [20,30,40,110,50,18], [32,5]  = 10, 268, 37 -> and it is not closely
and [10,20,30,40],[110],[50,18,32,5] = 100,110,105 -> it's closely

The Really answers that I want is [10,20,30,40],[110],[50,18,32,5] = 
100,110,105 from list[10,20,30,40,110,50,18,32,5]

And I don't know what I have to explain for my questions in English because My 
English so bad T_T

Thank you for reading my text

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


Re: How to process syntax errors

2016-10-10 Thread Chris Angelico
On Tue, Oct 11, 2016 at 1:13 AM,   wrote:
> Is there any way to capture syntax errors and process them ? I want to write 
> a function which calls every time whenever there is syntax error in the 
> program.
>
> For example,
>
> inside example.py
>
> I just mention below line
>
>
> Obj = myClass()
> Obj xyz
>
> Obj is instance of a class. But there is syntax error on xyz. So I want to 
> grab that error and process.

Yes and no. Syntax errors are detected when the script is compiled, so
you can't do something like this:

try:
Obj xyz
except SyntaxError:
print("Try Obj.xyz instead!")

However, you can catch this at some form of outer level. If you're
using exec/eval to run the code, you can guard that:

code = """
obj = MyClass() # using PEP 8 names
obj xyz
"""
try:
exec(code)
except SyntaxError:
print("Blah blah blah")

Alternatively, you can put the code into a file and import it:

# otherfile.py
obj = MyClass()
obj xyz

# mainfile.py
try:
import otherfile
except SyntaxError:
do_stuff()

This is probably the easiest solution, if your code's already in a
separate file.

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


[issue28403] Porting guide: disabling & warning on implicit unicode conversions

2016-10-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 10.10.2016 15:08, Petr Viktorin wrote:
> If sys.setdefaultencoding('undefined') breaks parts of the standard library, 
> it might be OK for smaller scripts but I fear it won't help big projects much.

That's true. It does break the stdlib (the codec was originally
added in order to test exactly this scenario).

A new codec "ascii-warn" could easily be added, based on the
code used for "undefined".

--

___
Python tracker 

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



Newbie Need Help On Regex!

2016-10-10 Thread infosecflag
Hey guys!
 
I am new to learning regex in python and I'm wondering how do I use regex in 
python to store the integers(positive and negative) i want into a list!
 
For e.g.
 
This is the data in a list.
 
[u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=-5,B=5)', 
u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=5,Y=5)', 
u'\x1b[0m[\x1b[1m\x1b[10m\xbb\x1b[0m\x1b[36m]\x1b[0m : ']
 
How do I extract the values of A and B and store them in a variable I want 
using regex?
 
Thank you and appreciate it :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Newbie Need Help On Regex!

2016-10-10 Thread infosecflag
Hey guys!
 
I am new to learning regex in python and I'm wondering how do I use regex in 
python to store the integers(positive and negative) i want into a list!
 
For e.g.
 
This is the data in a list.
 
[u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=-5,B=5)', 
u'\x1b[0m[\x1b[1m\x1b[0m\xbb\x1b[0m\x1b[36m]\x1b[0m (A=5,Y=5)', 
u'\x1b[0m[\x1b[1m\x1b[10m\xbb\x1b[0m\x1b[36m]\x1b[0m : ']
 
How do I extract the values of A and B and store them in a variable I want 
using regex?
 
Thank you and appreciate it :)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +inada.naoki, yselivanov

___
Python tracker 

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



[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread Masayuki Yamamoto

New submission from Masayuki Yamamoto:

I tried to build cpython on cygwin (vista x86).
Core interpretor has built to success, but '_futures' extension module has 
failed (compile error on Modules/_futuresmodule.c:946 ). It has occured since 
f8815001a390

part of build log:
$ uname -a
CYGWIN_NT-6.0 masayuki-PC 2.6.0(0.304/5/3) 2016-08-31 14:27 i686 Cygwin
$ ./configure --without-threads --prefix=/opt/py37
$ LANG=C make
(snip)
building '_futures' extension
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -I./Include -I/opt/py37/include -I. 
-I/usr/local/include -I/home/masayuki/var/repos/py37-work01/Include 
-I/home/masayuki/var/repos/py37-work01 -c 
/home/masayuki/var/repos/py37-work01/Modules/_futuresmodule.c -o 
build/temp.cygwin-2.6.0-i686-3.7/home/masayuki/var/repos/py37-work01/Modules/_futuresmodule.o
gcc -shared -Wl,--enable-auto-image-base 
build/temp.cygwin-2.6.0-i686-3.7/home/masayuki/var/repos/py37-work01/Modules/_futuresmodule.o
 -L. -L/opt/py37/lib -L/usr/local/lib -L. -lpython3.7m -o 
build/lib.cygwin-2.6.0-i686-3.7/_futures.dll
build/temp.cygwin-2.6.0-i686-3.7/home/masayuki/var/repos/py37-work01/Modules/_futuresmodule.o:
 In function `new_future_iter':
/home/masayuki/var/repos/py37-work01/Modules/_futuresmodule.c:946: undefined 
reference to `_PyGC_generation0'
/home/masayuki/var/repos/py37-work01/Modules/_futuresmodule.c:946: undefined 
reference to `_PyGC_generation0'
/home/masayuki/var/repos/py37-work01/Modules/_futuresmodule.c:946: undefined 
reference to `_PyGC_generation0'
collect2: error: ld returned 1 exit status
(snip)

--
components: Build, Extension Modules
messages: 278418
nosy: bquinlan, masamoto
priority: normal
severity: normal
status: open
title: Compile error on Modules/_futuresmodule.c
type: compile error
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



Re: PyQT - Signals and Slots?

2016-10-10 Thread Mark Summerfield

The ZeroSpinBox is a tiny example designed to show how the signal/slot
mechanism works. It is just a QSpinBox with the addition of remembering
how many times (all the) ZeroSpinBox(es) have had a 0 value.

Nowadays the connections would be made with a new improved syntax:

self.connect(self, SIGNAL("valueChanged(int)"), self.checkzero) # OLD
self.valueChanged.connect(self.checkzero) # NEW
# or
self.valueChanged[int].connect(self.checkzero) # NEW

Similarly the emit:
self.emit(SIGNAL("atzero"), self.zeros) # OLD
self.atzero.emit(self.zeros) # NEW

What's happening inside ZeroSpinBox? Whenever its value is set to 0 it
calls its own checkzero() method, and this in turn emits an atzero signal
with the number of zeros so far. Why does it do this? Just to show the
mechanism. It doesn't matter whether you connect a widget to itself
(unusual but done here), or to another widget (the norm).

See the book's website https://www.qtrac.eu/pyqtbook.html
for all the source code including some updated with the new syntax.
(But the book is old, so even the Python 3.1 examples aren't as Pythonic as 
they would be written in Python 3.4+.)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28405] Compile error on Modules/_futuresmodule.c

2016-10-10 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

I searched declaration for _PyGC_generation0, And it has be found at 
Include/objimpl.h:259
The found declaration hasn't used PyAPI_DATA macro. Hence, I wrote a patch to 
wrap declaration by the macro. I has succeeded to build _futures module using 
the patch.

By the way, I has found similar declarations and defines. I'd like to report 
them, but Should I create each another issues by places?

--
keywords: +patch
Added file: http://bugs.python.org/file45043/_PyGC_generation0-declaration.patch

___
Python tracker 

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



[issue28404] Logging SyslogHandler not appending '\n' to the end

2016-10-10 Thread José Manuel

José Manuel added the comment:

After reading the RFC5424 it seems that there is no such "new line message 
delimiter":


4.3.1.  Message Length

   The message length is the octet count of the SYSLOG-MSG in the
   SYSLOG-FRAME.  A transport receiver MUST use the message length to delimit a 
syslog message


So I think it must be a Fluentd error. This is what caused my confusion:

>From in_syslog.rb 
>(https://github.com/athenahealth/fluent-plugin-newsyslog/blob/master/lib/fluent/plugin/in_newsyslog.rb):


# syslog family add "\n" to each message and this seems only way to split 
messages in tcp stream
Coolio::TCPServer.new(@bind, @port, SocketUtil::TcpHandler, log, "\n", callback)


--

___
Python tracker 

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



Re: Deviding N(1, 2, 3, .., N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread Steve D'Aprano
On Tue, 11 Oct 2016 12:38 am, amornsak@gmail.com wrote:

> I have a list is
> 
> land = [10,20,30,40,110,50,18,32,5]
> 
> and I want to find each values of summation (don't sorted values in list)
> as It has highest as possible
> 
> example.
> 
> I want to dividing N=3 part from list as above and divieded each part has
> highest values that as possible. *** (don't sorted values in list)
> 
> first part has values is = 10, 20, 30, 40
> summation = 10+20+30+40 = 100

Why do you add four numbers? Why not add all the numbers?

10+20+30+40+110+50+18+32+5 = 315

> second part has values is = 110
> summation = 110

Why do you only take one number?


> and third part has values is = 50, 18, 32, 5
> summation = 105

Why do you take four numbers?

 
> that 100, 110 and 105 is highest values as possible in list by dividing
> N=3 part.

I do not understand, what do you mean "dividing N=3 part"?

Could you do this?

[10,20,30,40,110,50,18,32,5]

split into three lists:

[10,20,30,40,110,50,18], [32], [5]

Or these three lists:

[10], [20,30,40,110,50,18], [32,5]

Or these three lists:

[10,20,30], [40,110,50], [18,32,5]

How do you split the list into three?






-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


How to process syntax errors

2016-10-10 Thread mr . puneet . goyal
Hi 

Is there any way to capture syntax errors and process them ? I want to write a 
function which calls every time whenever there is syntax error in the program.

For example, 

inside example.py 

I just mention below line 


Obj = myClass()
Obj xyz

Obj is instance of a class. But there is syntax error on xyz. So I want to grab 
that error and process.

Regards, Puneet 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Function to take the minimum of 3 numbers

2016-10-10 Thread Steve D'Aprano
On Mon, 10 Oct 2016 10:56 am, Ian Kelly wrote:

> On Oct 9, 2016 2:57 PM,  alleged:

> The Pythonic way
> 
> if b >= a <= c:
> ...

I doubt that would be considered Pythonic by many people. Chained
comparisons are Pythonic, but not legal but weird combinations like 
`a == b < c is not d >= e <= f`.


> Better:
> 
> if a <= b <= c:
> ...

That's more like it. Unfortunately it doesn't mean the same as Mark's
version:

b >= a <= c means b >= a and a <= c
which is True for a = 1, b = 3 and c = 2;


a <= b <= c means a <= b and b <= c
which is False for a = 1, b = 3 and c = 2.


> Using consistent operators is not required but is easier to read and less
> confusing.

Indeed.





-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: Deviding N(1, 2, 3, .., N) part from numeric list as summation of each values(don't sorted) has highest possible.

2016-10-10 Thread Ben Bacarisse
Nune9  writes:

> I have a list is
>
> land = [10,20,30,40,110,50,18,32,5]
>
> and I want to find each values of summation (don't sorted values in
> list) as It has highest possible
>
> example.
>
> I want to dividing N=3 part from list as above and divieded each part
> has highest values that as possible.
> *** (don't sorted values in list)
>
> first part has values is = 10, 20, 30, 40
> summation = 10+20+30+40 = 100
>
> second part has values is = 110
> summation = 110
>
> and third part has values is = 50, 18, 32, 5
> summation = 105
>
> that 100, 110 and 105 is highest values as possible in list by
> dividing N=3 part.

So, given a sequence of numbers, you want to partition it into N
consecutive sub-sequences such that the sums of these sub sequences is,
somehow, maximal.  I say "somehow" because there are various possible
meanings for "highest" when applies to set of numbers.  Have I got that
part right?

It would help if you clarified a couple of things.  Are all numbers in
the sequence always positive, and what makes one set of numbers "higher"
than any other?  I imagine you want the most equal partition -- the one
that minimises the variance in the set of sums.

> and then If I want to divide N(1,2,3,...,N) part from any numeric
> list???

I don't understand this last bit at all.  The repeated use of N is not
helping me.

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


Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread Nuen9
Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't 
sorted) has highest as possible.

The first I'm sorry for my English language.

I have a list is

land = [10,20,30,40,110,50,18,32,5]

and I want to find each values of summation (don't sorted values in list) as It 
has highest as possible

example.

I want to dividing N=3 part from list as above and divieded each part has 
highest values that as possible.
*** (don't sorted values in list)

first part has values is = 10, 20, 30, 40
summation = 10+20+30+40 = 100

second part has values is = 110
summation = 110

and third part has values is = 50, 18, 32, 5
summation = 105

that 100, 110 and 105 is highest values as possible in list by dividing N=3 
part.

and then If I want to divide N(1,2,3,...,N) part from any more numeric list???

Thank you for python code

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


[issue28230] tarfile does not support pathlib

2016-10-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There are two kinds of paths in tarinfo:

1) External paths that correspond to filesystem paths. The path of the tar file 
itself, patches of added files and target directory for extraction. Supporting 
path protocol looks reasonable for them.

1) Internal paths, they are just string keys inside an archive. They come from 
TarFile.getnames() and always are strings. I'm not sure that pathlib have 
relation to this. This issue needs more thoughts. I would not haste with this.

--

___
Python tracker 

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



Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest as possible.

2016-10-10 Thread amornsak . nak
Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't 
sorted) has highest as possible.

The first I'm sorry for my English language.

I have a list is

land = [10,20,30,40,110,50,18,32,5]

and I want to find each values of summation (don't sorted values in list) as It 
has highest as possible

example.

I want to dividing N=3 part from list as above and divieded each part has 
highest values that as possible.
*** (don't sorted values in list)

first part has values is = 10, 20, 30, 40
summation = 10+20+30+40 = 100

second part has values is = 110
summation = 110

and third part has values is = 50, 18, 32, 5
summation = 105

that 100, 110 and 105 is highest values as possible in list by dividing N=3 
part.

and then If I want to divide N(1,2,3,...,N) part from any more numeric list???

Thank you for python code

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


PyQT - Signals and Slots?

2016-10-10 Thread Veek M
I'm reading Rapid GUI Programming - Mark Summerfield with Python and QT 
pg 131. Basically the mechanism is an event table which maps a 'signal' 
to a 'function/slot' -correct?

  self.connect(dial, SIGNAL("valueChanged(int)"), spinbox.setValue)

Here, dial.valueChanged -> spinbox.setValue

 s.connect(w, SIGNAL("signalSignature"), functionName)
 s.connect(w, SIGNAL("signalSignature"), instance.methodName)
 s.connect(w, SIGNAL("signalSignature"), instance, 
SLOT("slotSignature"))

Here, w.signalSignature -> functionName
-> instance.methodName
-> instance.slotSignature

If signalSignature is a C++ implemented thingy then we got to pass type 
info as part of the mapping so "signalSignature(int, float, const char 
*). PyQT signals are any type and any number of args..


If the Slot-function is implemented in C++ it's better to use the SLOT() 
mechanism:
 self.connect(dial, SIGNAL("valueChanged(int)"), spinbox, 
SLOT("setValue(int)"))
Here, we are mapping dial.valueChanged(int) --> spinbox.setValue(int)


The part i found tricky was this:

class ZeroSpinBox(QSpinBox):
zeros = 0
def __init__(self, parent=None):
super(ZeroSpinBox, self).__init__(parent)
self.connect(self, SIGNAL("valueChanged(int)"), self.checkzero)

def checkzero(self):
if self.value() == 0:
self.zeros += 1
self.emit(SIGNAL("atzero"), self.zeros)

ZeroSpinBox.valueChanged -> ZeroSpinBox.checkzero? Why is he mapping 
back to himself? Shouldn't it be widget-to-widget?

Then he raises a signal 'atzero' with one arg - the lack of a atzero() 
implies it's a 'short-circuit' signal so self.zeroes is a python data 
type. And in the book he says:

###
Here is how we connect to the signal in the form’s __init__() method:
zerospinbox = ZeroSpinBox()
...
self.connect(zerospinbox, SIGNAL("atzero"), self.announce)
Again, we must not use parentheses because it is a short-circuit signal. 
And
for completeness, here is the slot it connects to in the form:
def announce(self, zeros):
print "ZeroSpinBox has been at zero %d times" % zeros
###

Whaaa...t?? Could someone explain what exactly is his grand design 
besides being awfully circuitous? So he has some other Form thingy.. and 
in that he sets up another mapping from ZeroSpinBox.atzero --> 
ZeroSpinBox.announce  where's announce and atzero defined?





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


Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't sorted) has highest possible.

2016-10-10 Thread Nune9
Deviding N(1,2,3,..,N) part from numeric list as summation of each values(don't 
sorted) has highest possible.

The first I'm sorry for my English language.

I have a list is

land = [10,20,30,40,110,50,18,32,5]

and I want to find each values of summation (don't sorted values in list) as It 
has highest possible

example.

I want to dividing N=3 part from list as above and divieded each part has 
highest values that as possible.
*** (don't sorted values in list)

first part has values is = 10, 20, 30, 40
summation = 10+20+30+40 = 100

second part has values is = 110
summation = 110

and third part has values is = 50, 18, 32, 5
summation = 105

that 100, 110 and 105 is highest values as possible in list by dividing N=3 
part.

and then If I want to divide N(1,2,3,...,N) part from any numeric list???

Thank you for python code

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


Re: segfault using shutil.make_archive

2016-10-10 Thread Tim
On Friday, October 7, 2016 at 1:05:43 PM UTC-4, Michael Torrie wrote:
> On 10/06/2016 10:46 AM, Tim wrote:
> > I need to zip up a directory that's about 400mb.
> > I'm using shutil.make_archive and I'm getting this response:
> > 
> > Segmentation fault: 11 (core dumped)
> > 
> > The code is straightforward (and works on other, smaller dirs):
> > 
> > shutil.make_archive(os.path.join(zip_dir, zname), 'zip', tgt_dir)
> > 
> > I guess I could drop the convenience of make_archive and use zipfile but 
> > that seems to be exactly what make_archive does.
> > 
> > I'm on FreeBSD, python2.7.
> > 
> > Anyone seen this before?
> 
> Does normal the normal zip utility crash also when trying to zip up this
> large directory?  I'm not familiar with how shutils.make_archive works,
> but since it's part of shutils, I suspect it's calling the zip command
> as a subprocess, rather than using the Python zip module.  Given the
> size of your directory I doubt the zip module would work anyway.
> 
> If the zip command works, you could just execute it using popen from
> within Python.

I'm now using subprocess and the zip command from FreeBSD, and it's working. So 
far I can't reproduce a small example of the problem with make_archive.
--Tim
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28403] Porting guide: disabling & warning on implicit unicode conversions

2016-10-10 Thread Petr Viktorin

Petr Viktorin added the comment:

In portingguide [0] I could only recommend sitecustomize with a (possibly 
third-party) codec that emits warnings; not 'undefined'.

The things that aren't ported yet are generally either Non-Python applications 
with Python bindings or plugins (Gimp, Samba, ...), projects that are very 
large relative to the count of available maintainers (VCSs, Sugar, wxPython, 
...), or code that depends on those.

If sys.setdefaultencoding('undefined') breaks parts of the standard library, it 
might be OK for smaller scripts but I fear it won't help big projects much.


[0] http://portingguide.readthedocs.io/en/latest/

--

___
Python tracker 

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



[issue28230] tarfile does not support pathlib

2016-10-10 Thread Berker Peksag

New submission from Berker Peksag:

Here's an updated patch with different tests and documentation changes. I 
simplified Lib/tarfile.py a bit (see my review comments)

A slightly off-topic question: I had to update both docstrings and 
documentation. Should we use this as an opportunity to simplify the docstrings?

--
Added file: http://bugs.python.org/file45042/issue28230_v2.diff

___
Python tracker 

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



[issue28403] Porting guide: disabling & warning on implicit unicode conversions

2016-10-10 Thread Nick Coghlan

Nick Coghlan added the comment:

Adding Petr to the nosy list, as I'd like to get his perspective on this once I 
have a draft docs patch to review.

I also realised it made more sense to just repurpose this issue to cover the 
proposed docs updates.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, encukou
stage:  -> needs patch
title: Migration RFE: optional warning for implicit unicode conversions -> 
Porting guide: disabling & warning on implicit unicode conversions

___
Python tracker 

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



[issue28404] Logging SyslogHandler not appending '\n' to the end

2016-10-10 Thread José Manuel

New submission from José Manuel:

I'm using SyslogHandler from logging.handlers to send syslog messages to a 
Fluentd input 
(https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin/in_syslog.rb), 
both in TCP and UDP. UDP works fine, but TCP does not work. 

The "problem" is that the handler is not ending messages with a new line '\n' 
character (I realized that using tcpdump). I've temporarily added this to line 
855 of handlers.py: 
msg = prio + msg + '\n' 
And now is working. 

Now I'm confused because maybe this is not an issue but a problem of Fluentd. 
For the time, I will create a new class extending SyslogHandler and override 
the emit function.

Thank you for your time.

--
components: Library (Lib)
messages: 278412
nosy: elelement
priority: normal
severity: normal
status: open
title: Logging SyslogHandler not appending '\n' to the end
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue28403] Migration RFE: optional warning for implicit unicode conversions

2016-10-10 Thread Nick Coghlan

Nick Coghlan added the comment:

The main problem with the "undefined" encoding is that it actually *fails* the 
application, rather than allowing it to continue, but providing a warning at 
each new point where it encounters implicit encoding or decoding. This means 
the parts of the standard library that actually rely on implicit coercion fail 
outright, rather than just generate warning noise that you can filter out as 
irrelevant to your particular application.

You raise a good point about `sitecustomize.py` though - I always forget about 
that feature myself, and it didn't come up in any of the Google results I 
looked at either.

The existing "undefined" option also at least allows you to categorically 
ensure you're not relying on implicit conversions at all, so the Python 3 
porting guide could be updated to explicitly cover:

1. Finding the site customization path for your active virtual environment:

python -c 'import os.path, sysconfig; 
print(os.path.join(sysconfig.get_path("purelib"), "sitecustomize.py"))'

2. What to write to that location to disable implicit Unicode conversions:

import sys
sys.setdefaultencoding('undefined')

Giving folks the following tiered path to Python 3 support:

- get "pylint --py3k" passing (e.g. via python-modernize)
- eliminate "python -3" warnings under Python 2
- (optional) support running with the above site customizations
- actually run under Python 3

Brett, does the above approach sound reasonable to you? If so, then I'll do 
that as a pure documentation change in the Py3k porting guide with a "See Also" 
to the above blog post, and then mark this as closed/postponed (given the 
`sitecustomize` approach to enable it, the 3rd party codec should be fine for 
folks that want the warning behaviour instead)

--
nosy: +brett.cannon

___
Python tracker 

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



[issue28397] Faster index range checks

2016-10-10 Thread Stefan Krah

Stefan Krah added the comment:

The same applies to memoryview.c and _testbuffer.c -- I doubt that there's any 
measurable speed benefit and the clarity is reduced (I also don't want macros 
there).

--

___
Python tracker 

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



[issue28214] Improve exception reporting for problematic __set_name__ attributes

2016-10-10 Thread Nick Coghlan

Nick Coghlan added the comment:

You're right, RuntimeError is a more suitable exception type.

So +1 for the second version of the patch that uses `__cause__` and the patch 
itself looks good to me.

--

___
Python tracker 

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



Is there a free graph library to show program flow by tranverse AST tree

2016-10-10 Thread Ho Yeung Lee
can this graph library handle recursive function call this symbol 
If it recursive call a function 3 times then in the inner loop call another 
function , can this graph library 
Show this relationship
I find video that viv can show this program flow.
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >