Skip to content

Commit 3534eff

Browse files
feat: prefer linecache logic for error handling in python>=3.13
1 parent aee5087 commit 3534eff

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

python/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ Development should be done on `dev` branch, using `>=3.10` language features. Th
4242
- [ ] more documentation
4343
- [ ] javascript implementation
4444
- [x] improved error handling
45-
- display compiled code when error occurs through `linecache` or `tempfile` (default)
45+
- display compiled code when error occurs through `linecache` or `tempfile`

python/promplate/prompt/template.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ def compile(self, sync=True, indent_str="\t"):
117117
self._builder.add_line("return ''.join(map(str, __parts__))")
118118
self._builder.dedent()
119119

120-
error_handling: Literal["linecache", "tempfile", "file"] = "file" if __debug__ else "tempfile"
120+
error_handling: Literal["linecache", "tempfile", "file"]
121+
if version_info >= (3, 13):
122+
error_handling = "linecache"
123+
else:
124+
error_handling = "tempfile" if __debug__ else "file"
121125

122126
def _patch_for_error_handling(self, sync: bool):
123127
match self.error_handling:

python/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "promplate"
3-
version = "0.3.5.1"
3+
version = "0.3.5.2"
44
description = "Prompt engineering framework for humans"
55
homepage = "https://promplate.dev/"
66
documentation = "https://docs.py.promplate.dev/"

0 commit comments

Comments
 (0)