[PR #201] [MERGED] replace vector.data() with &vector[0] for MSVC90 compatibility #798

Open
opened 2026-01-29 20:50:57 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/201
Author: @anthrotype
Created: 10/2/2015
Status: Merged
Merged: 10/5/2015
Merged by: @szabadka

Base: masterHead: msvcrt90-cp27


📝 Commits (3)

  • b2f6c6d [setup.py] remove monkey-patch for distutils.msvc9compiler; try to import setuptools required by "Microsoft Visual C++ Compiler for Python 2.7"
  • 8a1fa66 [appveyor.yml] use WINDOWS_SDK_VERSION v7.0 for Python27-x64
  • 3e67d48 [brotlimodule.cc] remove C++11 vector::data() call

📊 Changes

3 files changed (+6 additions, -15 deletions)

View changed files

📝 appveyor.yml (+1 -1)
📝 python/brotlimodule.cc (+1 -1)
📝 setup.py (+4 -13)

📄 Description

This patch is meant to address issue #200, by replacing all uses of vector.data() with &vector[0].

I also removed the distutils patch inside setup.py, so that the correct MSVC compiler version is selected automatically based on the python version (9.0 for Py2.7, 10.0 for Python 3.4, etc.)

The import setuptools at the beginning of setup.py is required to use the "MS Visual C++ for Python 2.7" (http://aka.ms/vcpython27). Unfortunately the stock distutils fails to locate the vcvarsall.bat file..
This issue is fixed in setuptools (which is now bundled along with pip with the latest Python.org installers, and is the recommended way to distribute Python packages).

I know it looks terrible -- but at least shows how with little change we can make it work even with MSVC 9.0 and Windows Python 2.7.

Let me know what you think.
Thanks


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/201 **Author:** [@anthrotype](https://github.com/anthrotype) **Created:** 10/2/2015 **Status:** ✅ Merged **Merged:** 10/5/2015 **Merged by:** [@szabadka](https://github.com/szabadka) **Base:** `master` ← **Head:** `msvcrt90-cp27` --- ### 📝 Commits (3) - [`b2f6c6d`](https://github.com/google/brotli/commit/b2f6c6dbff143d98cb50490850e280fce9435364) [setup.py] remove monkey-patch for distutils.msvc9compiler; try to import setuptools required by "Microsoft Visual C++ Compiler for Python 2.7" - [`8a1fa66`](https://github.com/google/brotli/commit/8a1fa6631f1b1a660b758cfaaf61a4eab4e677ec) [appveyor.yml] use WINDOWS_SDK_VERSION v7.0 for Python27-x64 - [`3e67d48`](https://github.com/google/brotli/commit/3e67d48702bb2dd2df4af01fc3f8eb322e5e5370) [brotlimodule.cc] remove C++11 vector::data() call ### 📊 Changes **3 files changed** (+6 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `appveyor.yml` (+1 -1) 📝 `python/brotlimodule.cc` (+1 -1) 📝 `setup.py` (+4 -13) </details> ### 📄 Description This patch is meant to address issue #200, by replacing all uses of `vector.data()` with `&vector[0]`. I also removed the distutils patch inside setup.py, so that the correct MSVC compiler version is selected automatically based on the python version (9.0 for Py2.7, 10.0 for Python 3.4, etc.) The `import setuptools` at the beginning of setup.py is required to use the "MS Visual C++ for Python 2.7" (http://aka.ms/vcpython27). Unfortunately the stock distutils fails to locate the `vcvarsall.bat` file.. This issue is fixed in setuptools (which is now bundled along with pip with the latest Python.org installers, and is the recommended way to distribute Python packages). I know it looks terrible -- but at least shows how with little change we can make it work even with MSVC 9.0 and Windows Python 2.7. Let me know what you think. Thanks --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:50:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#798