Skip to content

Commit 4eb14db

Browse files
Merge pull request sympy#20285 from oscarbenjamin/pr_sympify_perf
perf(core): make sympify faster for Basic subclasses.
2 parents 2953b42 + 71e4698 commit 4eb14db

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sympy/core/sympify.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,13 @@ def sympify(a, locals=None, convert_xor=True, strict=False, rational=False,
344344
#
345345
# https://github.com/sympy/sympy/issues/20124
346346
is_sympy = getattr(a, '__sympy__', None)
347-
if is_sympy is True or (is_sympy is not None and not strict):
347+
if is_sympy is True:
348348
return a
349+
elif is_sympy is not None:
350+
if not strict:
351+
return a
352+
else:
353+
raise SympifyError(a)
349354

350355
if isinstance(a, CantSympify):
351356
raise SympifyError(a)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy