Skip to content

Commit 08cebd1

Browse files
authored
Merge pull request #1581 from rstudio/rchk-fixes
rchk fixes
2 parents 7eb3e3c + d3cc23f commit 08cebd1

File tree

5 files changed

+102
-55
lines changed

5 files changed

+102
-55
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ __pycache__
3737
^Dockerfile$
3838
^\.dockerignore$
3939
^\.git-blame-ignore-revs$
40+
^rchk$

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ issues/
1414
README.html
1515
index.html
1616
inst/doc
17-
.vscode/
17+
.vscode/
18+
rchk

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
to the original `sys.stdout` and `sys.stderr`, resulting in no further visible output
2424
from Python, and eventually, a segfault. (#1564)
2525

26+
- Fixed issues reported by rchk, as requested by CRAN (#1581).
27+
2628
- `py_to_r(x)` now returns `x` unmodified if `x` is not a Python object,
2729
instead of signaling an error.
2830

src/libpython.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ bool LibPython::loadSymbols(bool python3, std::string* pError)
290290
// PyUnicode_AsEncodedString may have several different names depending on the Python
291291
// version and the UCS build type
292292
std::vector<std::string> names;
293+
names.reserve(3);
293294
names.push_back("PyUnicode_AsEncodedString");
294295
names.push_back("PyUnicodeUCS2_AsEncodedString");
295296
names.push_back("PyUnicodeUCS4_AsEncodedString");

0 commit comments

Comments
 (0)