Mark accessors/return values that can be None with Optional[]

* This helps with type checkers to know that things can be None or not (both to
  silence previous warnings about "unnecessary" checks that are actually
  necessary, and to ensure those checks aren't omitted by accident)
This commit is contained in:
baldurk
2026-09-11 15:04:03 +01:00
parent ce50614f0e
commit 83c53890da
12 changed files with 113 additions and 74 deletions
+2 -2
View File
@@ -117,7 +117,7 @@ Picking the first of these, we can then :ref:`move to that event <currentevent>`
.. highlight:: python
.. code:: python
if not refl.debugInfo.debuggable:
if refl is None or not refl.debugInfo.debuggable:
print("Shader can't be debugged:")
print(refl.debugInfo.debugStatus)
return
@@ -342,4 +342,4 @@ This example can be found under the name "Pixel History & Shader Debug" in the p
:download:`Download the example script <history_debug.py>`.
.. literalinclude:: history_debug.py
.. literalinclude:: history_debug.py