53 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
The ``++raise a, b++`` syntax is deprecated in Python 3, and should no longer be used.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,python]
2021-04-28 16:49:39 +02:00
----
try:
if not is_okay:
raise Exception, 'It\'s not okay' # Noncompliant
except Exception as e:
# ...
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,python]
2021-04-28 16:49:39 +02:00
----
try:
if not is_okay:
raise Exception('It\'s not okay')
except Exception as e:
# ...
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use "x" to raise an exception here.
'''
== Comments And Links
(visible only on this page)
=== on 21 Apr 2015, 09:07:09 Elena Vilchik wrote:
\[~ann.campbell.2] I changed the message. For code example it could be "Use "Exception('It's not okay')" to raise an exception here." wdyt?
=== on 21 Apr 2015, 09:24:19 Ann Campbell wrote:
\[~elena.vilchik] that message is fine with me. Note, however, that in the past we've steered away from such messages because of potential message length. Limitations in the platform - which have since been removed - were partly responsible for that.
endif::env-github,rspecator-view[]