From faf7dfa656bd52959156fed39a4c680b2b13e032 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Fri, 11 Nov 2022 12:56:57 +0300 Subject: gh-99325: Remove unused `NameError` handling (#99326) --- Lib/copyreg.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'Lib/copyreg.py') diff --git a/Lib/copyreg.py b/Lib/copyreg.py index c8a52a2dc6..578392409b 100644 --- a/Lib/copyreg.py +++ b/Lib/copyreg.py @@ -25,16 +25,10 @@ def constructor(object): # Example: provide pickling support for complex numbers. -try: - complex -except NameError: - pass -else: +def pickle_complex(c): + return complex, (c.real, c.imag) - def pickle_complex(c): - return complex, (c.real, c.imag) - - pickle(complex, pickle_complex, complex) +pickle(complex, pickle_complex, complex) def pickle_union(obj): import functools, operator -- cgit v1.2.1