[issue44938] Expose PyErr_ChainExceptions in the stable API

2021-12-10 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

related: https://www.python.org/dev/peps/pep-0490/ (rejected pep to auto-chain 
from C API calls)

I don't come across it often, but I did just review some code at work today 
where the chain might have been nice (though not a big deal).

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue44938] Expose PyErr_ChainExceptions in the stable API

2021-08-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

As long as the cycles don't actually end in a crash or an infinite cycle, I 
think is fine to not include them in the contact.

Even if that were included I don't think is actually a problem. Many APIs in C 
or C++ require the user to not form cycles, for instance, shared pointers in 
the c++ stdlib.

--

___
Python tracker 

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



[issue44938] Expose PyErr_ChainExceptions in the stable API

2021-08-22 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

I agree with Serhiy that this API isn't necessarily the right one. It's just 
what happens to be there now. Also, we're still not clear on our stance towards 
cycles (see the issue25782 discussion). (Maybe the exposed version should 
result in an error if it would cause a cycle to be created.) Someone would need 
to think through what the API should be, though.

--
nosy: +chris.jerdonek

___
Python tracker 

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



[issue44938] Expose PyErr_ChainExceptions in the stable API

2021-08-18 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Serhiy, what do you suggest we should do then?

--

___
Python tracker 

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



[issue44938] Expose PyErr_ChainExceptions in the stable API

2021-08-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

As the original author of _PyErr_ChainExceptions() (issue21715) I am not sure 
that its name and signature are optimal. It did not matter while it was 
internal function because we could change them at any moment, but for public 
API the design should be more thoughtful.

Is passing three arguments convenient enough? Would not be better to pass them 
as a single argument like in _PyErr_ChainStackItem()? Is the function name 
good? Should we provide several similar functions for setting __context__, 
__cause__ and both?

There are other, more specialized, helpers: _PyErr_FormatFromCause() and 
_PyErr_TrySetFromCause().

There are also some flaws in setting __context__ and __cause__ (see 
issue39725). Perhaps we will design better concept of chaining exceptions in 
future.

--
components: +C API
nosy: +serhiy.storchaka
type:  -> enhancement
versions: +Python 3.11

___
Python tracker 

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



[issue44938] Expose PyErr_ChainExceptions in the stable API

2021-08-17 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +26267
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27799

___
Python tracker 

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



[issue44938] Expose PyErr_ChainExceptions in the stable API

2021-08-17 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

Currently, exception chaining in the C-API must be done by hand. This is a 
painstaking process that involves several steps and is very easy to do 
incorrectly.

We currently have a private function: _PyErr_ChainExceptions that does this 
job. Given that exception chaining is a very fundamental operation, this 
functionality must be exposed in the stable C-API

--
messages: 399777
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Expose PyErr_ChainExceptions in the stable API

___
Python tracker 

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