Files
nuitka-mirror/tests/programs/syntax_errors/SyntaxErrorsMain.py
Kay Hayen 4f2cc6ae93 Optimization: Enhanced exception handling
* Use exception state to abstract 3.12 or before differences. This
  solves a TODO about more very in-efficient code generated that
  also requires many conversions of exceptions back and forth from
  3 value form to normalized.

* Moved compile time debug settings to separate file.

* Pass the exception state into unpacking function for more
  efficient code. No need to fetch exceptions per use of
  those into the exception state, but it can directly write to
  there.

* Solve TODO and have helper for unpacking length check. When
  migrating to Python3, this became a custom template with a
  lot of manual code that pre-defined the error messages to
  give too.

* Have our own variant of "_PyGen_FetchStopIterationValue" to
  avoid API calls in generator handling.

* Generate more efficient code for raising exceptions of builtin
  type. Rather than calling them as a function, create them via
  base exception new directly which will be much quicker.

* Faster exception creation, avoid having "args" and a tuple need
  to hole them for empty exceptions avoiding one more allocation.

* Remove uses of "PyTuple_Pack" and replace with our own helpers
  to avoid API calls.

* Avoid implicit exception raise nodes with delayed creation, have
  exception making nodes instead.
2024-12-18 11:09:55 +01:00

34 lines
1.1 KiB
Python

# Copyright 2024, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
# nuitka-project: --follow-imports
from __future__ import print_function
try:
from SyntaxErroring import x
except Exception as e:
print("Importing with syntax error gave:", type(e), e)
try:
from IndentationErroring import x
except Exception as e:
print("Importing with indentation error gave:", type(e), e)
print("Finished.")
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.