Skip to content

Commit b379ef3

Browse files
DanielNoordjacobtylerwalls
authored andcommitted
Fix handling of quoted init-hook (#7010)
Co-authored-by: Jacob Walls <[email protected]>
1 parent c159024 commit b379ef3

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

doc/whatsnew/2/2.14/full.rst

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Release date: TBA
99

1010
Closes #6950
1111

12+
* Fixed regression that didn't allow quoted ``init-hooks`` in option files.
13+
14+
Closes #7006
1215

1316
What's New in Pylint 2.14.3?
1417
----------------------------

pylint/config/config_initialization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _config_initialization(
4545

4646
# Run init hook, if present, before loading plugins
4747
if "init-hook" in config_data:
48-
exec(config_data["init-hook"]) # pylint: disable=exec-used
48+
exec(utils._unquote(config_data["init-hook"])) # pylint: disable=exec-used
4949

5050
# Load plugins if specified in the config file
5151
if "load-plugins" in config_data:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
I should just print
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Check that we support quoted init-hooks
2+
# See https://github.com/PyCQA/pylint/issues/7006
3+
[MAIN]
4+
init-hook='print("I should just print")'

0 commit comments

Comments
 (0)