Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fix an issue where destructuring a vector would throw an exception rather than returning `nil` for invalid key types (#1090)
* Fix an issue where destructuring default values would take precedence over falsey values in the source data structure (#1078)
* Fixed a bug where imported Python names containing `-` (in lieu of `_`) could not be referenced using the `-` syntax (#1085)
* Fixed a compatibility issue where `*print-length*` defaulted to 50 instead of `nil` (#1093)

### Removed
* Removed support for Python 3.8 (#1083)
Expand Down
2 changes: 1 addition & 1 deletion src/basilisp/lang/obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
SURPASSED_PRINT_LEVEL = "#"

PRINT_DUP = False
PRINT_LENGTH: PrintCountSetting = 50
PRINT_LENGTH: PrintCountSetting = None
PRINT_LEVEL: PrintCountSetting = None
PRINT_META = False
PRINT_NAMESPACE_MAPS = False
Expand Down
14 changes: 13 additions & 1 deletion src/basilisp/lang/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2460,7 +2460,19 @@ def in_ns(s: sym.Symbol):
CORE_NS_SYM, sym.symbol(PRINT_DUP_VAR_NAME), lobj.PRINT_DUP, dynamic=True
)
Var.intern(
CORE_NS_SYM, sym.symbol(PRINT_LENGTH_VAR_NAME), lobj.PRINT_LENGTH, dynamic=True
CORE_NS_SYM,
sym.symbol(PRINT_LENGTH_VAR_NAME),
lobj.PRINT_LENGTH,
dynamic=True,
meta=lmap.map(
{
_DOC_META_KEY: (
"Limits the number of items printed per collection. If falsy, all items are shown."
" If set to an integer, only that many items are printed,"
" with ``...`` indicating more. By default, it is ``nil``, meaning no limit."
)
}
),
)
Var.intern(
CORE_NS_SYM, sym.symbol(PRINT_LEVEL_VAR_NAME), lobj.PRINT_LEVEL, dynamic=True
Expand Down
8 changes: 8 additions & 0 deletions tests/basilisp/test_core_fns.lpy
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
(:require
[basilisp.io :as bio]
[basilisp.set :as set]
[basilisp.string :as str]
[basilisp.test :refer [deftest are is testing]]))

(deftest vec-test
Expand Down Expand Up @@ -2553,6 +2554,13 @@
(testing "is dynamic"
(is (= '(1) (binding [pr (fn [& more] more)] (pr 1)))))

(testing "*print-level* support"
(let [v-str (pr-str (range 100))]
(is (str/ends-with? v-str " 99)") v-str))

(binding [*print-length* 4]
(is (= "(0 1 2 3 ...)" (pr-str (range 5))))))

(testing "with *print-namespace-maps*"
(is (= "#py {:a/x 5}" (binding [*print-namespace-maps* false] (pr-str #py {:a/x 5}))))
(is (= "#py #:a{:x 5}" (binding [*print-namespace-maps* true] (pr-str #py {:a/x 5}))))
Expand Down
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ commands =
ruff check src/

[testenv:safety]
deps = safety
deps =
safety
# work around 3.13 issue to avoid building an earlier version of pydantic-core on macos
pydantic-core>=2.25.0
commands =
safety check -i 40291 -i 67599 -i 70612
Loading